mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2025-02-22 14:20:22 +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.
|
||||
-- @return An error message if the code fails, or nil on success.
|
||||
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")
|
||||
if not factory then -- Syntax error
|
||||
return false, err
|
||||
|
Loading…
x
Reference in New Issue
Block a user