Skip to content

Commit

Permalink
support for //lua =... added
Browse files Browse the repository at this point in the history
  • Loading branch information
imre84 committed Mar 28, 2024
1 parent 3b6b761 commit b9232f0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions worldedit/code.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b9232f0

Please sign in to comment.