mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2025-07-03 16:40:38 +02:00
support for //lua =... added
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user