From b2b7232d1ad246c7534296d88f0b8f71c0a33d07 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 17 Apr 2014 11:58:53 +1000 Subject: Actually get skin running to work. --- ClientHamr/GuiLua/skang.lua | 16 ++++++++++------ ClientHamr/GuiLua/test.skang | 8 ++++---- 2 files changed, 14 insertions(+), 10 deletions(-) (limited to 'ClientHamr') diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index b33d003..3e9314f 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua @@ -352,17 +352,21 @@ moduleEnd = function (module) end pullArguments(module) - if module.isLua then setfenv(2, module.savedEnvironment) end -- Run the main skin, which is the first skin that is defined. In theory, the skin from the main module. if mainSkin == module then -print("~~~~~~~~~~~~~~~~~RUNNING SKIN FOR " .. module._NAME .. '\n' .. module.DEFAULT_SKANG) - local main = loadstring(module.DEFAULT_SKANG) - if (main) then - setfenv(main, getfenv(2)) - main() + print("~~~~~~~~~~~~~~~~~RUNNING SKIN FOR " .. module._NAME) +print(module.DEFAULT_SKANG .. '\n~~~~~~~~~~~~~~~~~') + local skin, err = loadstring(module.DEFAULT_SKANG) + if skin then + setfenv(skin, getfenv(2)) + skin() + else + print("ERROR - " .. err) end end + + if module.isLua then setfenv(2, module.savedEnvironment) end end diff --git a/ClientHamr/GuiLua/test.skang b/ClientHamr/GuiLua/test.skang index 20430e1..015b3b9 100644 --- a/ClientHamr/GuiLua/test.skang +++ b/ClientHamr/GuiLua/test.skang @@ -6,12 +6,12 @@ local widget = require 'widget' -- local other = require 'otherPackageName' -skang.clear +skang.clear() skang.window(200, 200, "G'day planet.") -quitter = widget.button('Quit', 0.5, 0.5, 0.5, 0.5) -quitter:action('quit') -- 'quit' is looked up in ThingSpace.commands, and translated into the Lua 'skang.quit()'. +--quitter = widget.button('Quit', 0.5, 0.5, 0.5, 0.5) +--quitter:action('quit') -- 'quit' is looked up in ThingSpace.commands, and translated into the Lua 'skang.quit()'. --other.foo = 'stuff' this.bar = 'things' -this.func(1, 'two') +this.ffunc(1, 'two') -- cgit v1.1