diff options
author | David Walter Seikel | 2014-04-17 11:58:53 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-04-17 11:58:53 +1000 |
commit | b2b7232d1ad246c7534296d88f0b8f71c0a33d07 (patch) | |
tree | 053f2f8e6168d27c084f284372317fd54247be30 | |
parent | Figure out which is the main skin and run it. (diff) | |
download | SledjHamr-b2b7232d1ad246c7534296d88f0b8f71c0a33d07.zip SledjHamr-b2b7232d1ad246c7534296d88f0b8f71c0a33d07.tar.gz SledjHamr-b2b7232d1ad246c7534296d88f0b8f71c0a33d07.tar.bz2 SledjHamr-b2b7232d1ad246c7534296d88f0b8f71c0a33d07.tar.xz |
Actually get skin running to work.
-rw-r--r-- | ClientHamr/GuiLua/skang.lua | 16 | ||||
-rw-r--r-- | ClientHamr/GuiLua/test.skang | 8 |
2 files changed, 14 insertions, 10 deletions
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) | |||
352 | end | 352 | end |
353 | 353 | ||
354 | pullArguments(module) | 354 | pullArguments(module) |
355 | if module.isLua then setfenv(2, module.savedEnvironment) end | ||
356 | 355 | ||
357 | -- Run the main skin, which is the first skin that is defined. In theory, the skin from the main module. | 356 | -- 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 | 357 | if mainSkin == module then |
359 | print("~~~~~~~~~~~~~~~~~RUNNING SKIN FOR " .. module._NAME .. '\n' .. module.DEFAULT_SKANG) | 358 | print("~~~~~~~~~~~~~~~~~RUNNING SKIN FOR " .. module._NAME) |
360 | local main = loadstring(module.DEFAULT_SKANG) | 359 | print(module.DEFAULT_SKANG .. '\n~~~~~~~~~~~~~~~~~') |
361 | if (main) then | 360 | local skin, err = loadstring(module.DEFAULT_SKANG) |
362 | setfenv(main, getfenv(2)) | 361 | if skin then |
363 | main() | 362 | setfenv(skin, getfenv(2)) |
363 | skin() | ||
364 | else | ||
365 | print("ERROR - " .. err) | ||
364 | end | 366 | end |
365 | end | 367 | end |
368 | |||
369 | if module.isLua then setfenv(2, module.savedEnvironment) end | ||
366 | end | 370 | end |
367 | 371 | ||
368 | 372 | ||
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 @@ | |||
6 | local widget = require 'widget' | 6 | local widget = require 'widget' |
7 | -- local other = require 'otherPackageName' | 7 | -- local other = require 'otherPackageName' |
8 | 8 | ||
9 | skang.clear | 9 | skang.clear() |
10 | skang.window(200, 200, "G'day planet.") | 10 | skang.window(200, 200, "G'day planet.") |
11 | 11 | ||
12 | quitter = widget.button('Quit', 0.5, 0.5, 0.5, 0.5) | 12 | --quitter = widget.button('Quit', 0.5, 0.5, 0.5, 0.5) |
13 | quitter:action('quit') -- 'quit' is looked up in ThingSpace.commands, and translated into the Lua 'skang.quit()'. | 13 | --quitter:action('quit') -- 'quit' is looked up in ThingSpace.commands, and translated into the Lua 'skang.quit()'. |
14 | 14 | ||
15 | --other.foo = 'stuff' | 15 | --other.foo = 'stuff' |
16 | this.bar = 'things' | 16 | this.bar = 'things' |
17 | this.func(1, 'two') | 17 | this.ffunc(1, 'two') |