mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2025-02-23 14:50:18 +01:00
support for //lua =... added
This commit is contained in:
parent
a6f68ed4e7
commit
d4ca3db924
@ -4,6 +4,9 @@
|
|||||||
--- Executes `code` as a Lua chunk in the global namespace.
|
--- Executes `code` as a Lua chunk in the global namespace.
|
||||||
-- @return An error message if the code fails, or nil on success.
|
-- @return An error message if the code fails, or nil on success.
|
||||||
function worldedit.lua(code, name)
|
function worldedit.lua(code, name)
|
||||||
|
if string.sub(code,1,1)=="=" then
|
||||||
|
code="return "..string.sub(code,2)
|
||||||
|
end
|
||||||
local factory, err = loadstring("return function(p) " .. code .. " end")
|
local factory, err = loadstring("return function(p) " .. code .. " end")
|
||||||
if not factory then -- Syntax error
|
if not factory then -- Syntax error
|
||||||
return false, err
|
return false, err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user