[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Cleaning up specific lua scripts
- From: Pierre-Yves Gérardy <pygy79@...>
- Date: Fri, 26 Mar 2010 10:08:24 +0100
One last thing:
local loadLevel = function(levelpath)
local levelenv=setmetatable({},levelMT)
local levelcode=loadfile(levelpath)
local MTindex={}
-- ^^ Put the definition here rather than in the main chunk
setfenv(levelcode,levelenv)
protectTable(_G,MTindex)
local ret = levelcode()
unprotectTable(_G,MTindex)
return ret
end
-- Pierre-Yves