From e101059595b6003d42cbc033675a24c7f2a387a2 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 20 Apr 2014 05:24:24 +1000 Subject: Have the skin loader add the correct require line, and fix up test to suit. --- ClientHamr/GuiLua/skang.lua | 5 ++--- ClientHamr/GuiLua/test.lua | 8 +++----- ClientHamr/GuiLua/test.skang | 9 +++------ 3 files changed, 8 insertions(+), 14 deletions(-) (limited to 'ClientHamr') diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index af315e3..4fb84f1 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua @@ -144,7 +144,7 @@ moduleBegin = function (name, author, copyright, version, timestamp, skin, isLua f:close() end if skin then - skin = "local skang = require 'skang'\nlocal this = require 'test'\n" .. skin + skin = "local skang = require 'skang'\nlocal " .. name .. " = require '" .. name .. "'\n" .. skin if nil == mainSkin._NAME then mainSkin = _M end end _M.DEFAULT_SKANG = skin @@ -358,8 +358,7 @@ moduleEnd = function (module) -- 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) -print(module.DEFAULT_SKANG .. '\n~~~~~~~~~~~~~~~~~') + print("RUNNING SKIN FOR " .. module._NAME) local skin, err = loadstring(module.DEFAULT_SKANG) if skin then setfenv(skin, getfenv(2)) diff --git a/ClientHamr/GuiLua/test.lua b/ClientHamr/GuiLua/test.lua index 65e686f..705f7ad 100644 --- a/ClientHamr/GuiLua/test.lua +++ b/ClientHamr/GuiLua/test.lua @@ -4,11 +4,9 @@ do -- Only I'm not gonna indent this. local skang = require 'skang' local _M = skang.moduleBegin('test', nil, 'Copyright 2014 David Seikel', '0.1', '2014-03-27 03:57:00', [[ - - skang.clear - skang.window(200, 200, "G'day planet.") - quitter = skang.button('Quit', 0.5, 0.5, 0.5, 0.5) - quitter:action('quit') + local win = skang.window(500, 500, "G'day planet.", 'testWindow') + skang.thingasm{win, 'quitter', 'Quits the skang window', types = 'widget', widget='"button", "Quit", 10, 10, 100, 30'} + win.W.quitter.action = 'skang.quit()' -- TODO Should look it up in ThingSpace.commands, and translat 'quit' into the Lua 'skang.quit()'? ]]) print('code') diff --git a/ClientHamr/GuiLua/test.skang b/ClientHamr/GuiLua/test.skang index 518207b..de417da 100644 --- a/ClientHamr/GuiLua/test.skang +++ b/ClientHamr/GuiLua/test.skang @@ -1,9 +1,7 @@ #!/usr/bin/env skang -l test -- Lua allows this shell hack. --- There's an implied local this = require 'test' -- There's an implied local skang = require 'skang' - --- local other = require 'otherPackageName' +-- There's an implied local test = require 'test' -- This is a bit more verbose than I wanted. lol local win = skang.window(500, 500, "G'day planet.", 'testWindow') @@ -12,6 +10,5 @@ win.W.quitter.action = 'skang.quit()' -- TODO Should look it up in ThingSpace.c skang.thingasm{win, 'ffuncer', 'Calls ffunc', types = 'widget', widget='"button", "ffunc()", 10, 40, 100, 30', action='test.ffunc(3, 4)'} ---other.foo = 'stuff' -this.bar = 'things' -this.ffunc(1, 'two') +test.bar = 'things' +test.ffunc(1, 'two') -- cgit v1.1