From be71eb02a95ed48d593302ddd6e6595e9967163a Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Tue, 8 Apr 2014 01:52:16 +1000 Subject: Fix up getfenv() call for GuiLua, though it doesn't really make sense. --- ClientHamr/GuiLua/skang.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index 9689936..4f221a0 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua @@ -1,7 +1,7 @@ --[[ TODO - This should be in C, but so far development has been quite rapid doing it in Lua. C will let us - - Use Ecore's main loop. Actually do the widget stuff. + Use Ecore's main loop. Slap meta tables on all value types. Which lets us put the meta table on the variable, instead of on the table, which I think is cleaner. Figure out the directory separator. @@ -95,7 +95,13 @@ moduleBegin = function (name, author, copyright, version, timestamp, skin, isLua -- Should do this before any further require(), so that circular references don't blow out. -- Save the callers environment. - local savedEnvironment = getfenv(level) + local savedEnvironment + if isLua then + savedEnvironment = getfenv(level) + else + -- While the above works fine for test_c, it doesn't for GuiLua. Odd. + savedEnvironment = getfenv(1) + end -- Clone the environment into _M, so the module can access everything as usual after the setfenv() below. --[[ TODO - Check if this also clones _G or _ENV. And see if it leaks stuff in either direction. -- cgit v1.1