aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-04-17 00:52:25 +1000
committerDavid Walter Seikel2014-04-17 00:52:25 +1000
commit05895e27beddd6d83f8f46013cb3842f4e7853d9 (patch)
tree797f444e92935cdbdf0c817652be80e722096474
parentComment fix ups. (diff)
downloadSledjHamr-05895e27beddd6d83f8f46013cb3842f4e7853d9.zip
SledjHamr-05895e27beddd6d83f8f46013cb3842f4e7853d9.tar.gz
SledjHamr-05895e27beddd6d83f8f46013cb3842f4e7853d9.tar.bz2
SledjHamr-05895e27beddd6d83f8f46013cb3842f4e7853d9.tar.xz
Figure out which is the main skin and run it.
-rw-r--r--ClientHamr/GuiLua/skang.lua16
1 files changed, 15 insertions, 1 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua
index dec8983..b33d003 100644
--- a/ClientHamr/GuiLua/skang.lua
+++ b/ClientHamr/GuiLua/skang.lua
@@ -67,6 +67,7 @@ The old skang argument types are -
67-- By virtue of the fact we are stuffing our result into package.loaded[], just plain running this works as "loading the module". 67-- By virtue of the fact we are stuffing our result into package.loaded[], just plain running this works as "loading the module".
68do -- Only I'm not gonna indent this. 68do -- Only I'm not gonna indent this.
69 69
70mainSkin = {}
70 71
71-- TODO - This needs to be expanded a bit to cover things like 1.42 72-- TODO - This needs to be expanded a bit to cover things like 1.42
72local versions = { 73local versions = {
@@ -141,7 +142,10 @@ moduleBegin = function (name, author, copyright, version, timestamp, skin, isLua
141 skin = skin .. f:read('*a') 142 skin = skin .. f:read('*a')
142 f:close() 143 f:close()
143 end 144 end
144 if skin then skin = "local skang = require 'skang'\nlocal this = require 'test'\n" .. skin end 145 if skin then
146 skin = "local skang = require 'skang'\nlocal this = require 'test'\n" .. skin
147 if nil == mainSkin._NAME then mainSkin = _M end
148 end
145 _M.DEFAULT_SKANG = skin 149 _M.DEFAULT_SKANG = skin
146 150
147 --_G[_M._NAME] = _M -- Stuff it into a global of the same name. 151 --_G[_M._NAME] = _M -- Stuff it into a global of the same name.
@@ -349,6 +353,16 @@ moduleEnd = function (module)
349 353
350 pullArguments(module) 354 pullArguments(module)
351 if module.isLua then setfenv(2, module.savedEnvironment) end 355 if module.isLua then setfenv(2, module.savedEnvironment) end
356
357 -- Run the main skin, which is the first skin that is defined. In theory, the skin from the main module.
358 if mainSkin == module then
359print("~~~~~~~~~~~~~~~~~RUNNING SKIN FOR " .. module._NAME .. '\n' .. module.DEFAULT_SKANG)
360 local main = loadstring(module.DEFAULT_SKANG)
361 if (main) then
362 setfenv(main, getfenv(2))
363 main()
364 end
365 end
352end 366end
353 367
354 368