aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--ClientHamr/GuiLua/skang.lua10
-rw-r--r--ClientHamr/GuiLua/test.lua26
2 files changed, 18 insertions, 18 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua
index d5622fd..bd05031 100644
--- a/ClientHamr/GuiLua/skang.lua
+++ b/ClientHamr/GuiLua/skang.lua
@@ -116,7 +116,15 @@ moduleBegin = function (name, author, copyright, version, timestamp, skin, isLua
116 end 116 end
117 _M.VERSION = version .. versionName .. timestamp 117 _M.VERSION = version .. versionName .. timestamp
118 _M.VERSION_DESC = versionDesc 118 _M.VERSION_DESC = versionDesc
119 -- TODO - If there's no skin passed in, try to find the file skin .. '.skang' and load that instead. 119 -- If there is a .skang file, read that in and override the passed in skin.
120 local f = io.open(name .. '.skang')
121 if f then
122 skin = f:read('*l')
123 if '#' == string.sub(skin, 1, 1) then skin = '' end
124 skin = skin .. f:read('*a')
125 f:close()
126 end
127 if skin then skin = "local skang = require 'skang'\nlocal this = require 'test'\n" .. skin end
120 _M.DEFAULT_SKANG = skin 128 _M.DEFAULT_SKANG = skin
121 129
122 --_G[_M._NAME] = _M -- Stuff it into a global of the same name. 130 --_G[_M._NAME] = _M -- Stuff it into a global of the same name.
diff --git a/ClientHamr/GuiLua/test.lua b/ClientHamr/GuiLua/test.lua
index 4ddbc1d..f45aff9 100644
--- a/ClientHamr/GuiLua/test.lua
+++ b/ClientHamr/GuiLua/test.lua
@@ -4,26 +4,14 @@ do -- Only I'm not gonna indent this.
4 4
5local skang = require 'skang' 5local skang = require 'skang'
6local _M = skang.moduleBegin('test', nil, 'Copyright 2014 David Seikel', '0.1', '2014-03-27 03:57:00', [[ 6local _M = skang.moduleBegin('test', nil, 'Copyright 2014 David Seikel', '0.1', '2014-03-27 03:57:00', [[
7#!/usr/bin/env skang -- Lua allows this shell hack. 7 local widget = require 'widget'
8 8
9-- There's an implied local this = require 'test' 9 skang.clear
10-- There's an implied local skang = require 'skang' 10 skang.window(200, 200, "G'day planet.")
11 11 quitter = widget.button('Quit', 0.5, 0.5, 0.5, 0.5)
12local widget = require 'widget' 12 quitter:action('quit')
13-- local other = require 'otherPackageName'
14
15skang.clear
16skang.window(200, 200, "G'day planet.")
17
18quitter = widget.button('Quit', 0.5, 0.5, 0.5, 0.5)
19quitter:action('quit') -- 'quit' is looked up in ThingSpace.commands, and translated into the Lua 'skang.quit()'.
20
21--other.foo = 'stuff'
22this.bar = 'things'
23this.func(1, 'two')
24]]) 13]])
25 14
26
27print('code') 15print('code')
28 16
29-- A variable that is private to this module. 17-- A variable that is private to this module.
@@ -53,6 +41,10 @@ local test_c = require 'test_c'
53local copy = skang.copy(test, 'copy') 41local copy = skang.copy(test, 'copy')
54 42
55print('End ' .. test.bar .. ' ' .. test.VERSION .. ' ' .. skang.get(test, 'ffunc', 'help') .. ' ->> ' .. skang.get(test, 'f', 'action')) 43print('End ' .. test.bar .. ' ' .. test.VERSION .. ' ' .. skang.get(test, 'ffunc', 'help') .. ' ->> ' .. skang.get(test, 'f', 'action'))
44
45print(test.DEFAULT_SKANG)
46print('')
47
56print('foo = ' .. test.foo .. ' ->> ' .. skang.get(test, 'foo', 'help')) 48print('foo = ' .. test.foo .. ' ->> ' .. skang.get(test, 'foo', 'help'))
57print('cfooble = ' .. test_c.cfooble .. ' ->> ' .. skang.get(test_c, 'cfooble', 'help') .. '[' .. skang.get(test_c, 'cfooble', 'widget') .. ']') 49print('cfooble = ' .. test_c.cfooble .. ' ->> ' .. skang.get(test_c, 'cfooble', 'help') .. '[' .. skang.get(test_c, 'cfooble', 'widget') .. ']')
58print('cfunc ->> ' .. skang.get(test_c, 'cfunc', 'help')) 50print('cfunc ->> ' .. skang.get(test_c, 'cfunc', 'help'))