luablock: add a "pos" table in env containing the LuaBlock position

This commit is contained in:
upsilon 2017-05-01 12:52:05 +02:00
parent f44bdbfb36
commit 8c267be40d
No known key found for this signature in database
GPG Key ID: A80DAE1F266E1C3C
1 changed files with 3 additions and 0 deletions

View File

@ -98,6 +98,9 @@ minetest.register_node("moremesecons_luablock:luablock", {
make_formspec(meta, pos)
return
end
local env = _G
env.pos = table.copy(pos)
setfenv(func, env)
local good, err = pcall(func)
-- Still alive! No shutdown requested? No infinite loop?
if not good then -- Runtime error