diff options
-rw-r--r-- | lib/skang.lua | 2 | ||||
-rw-r--r-- | src/GuiLua/GuiLua.c | 2 | ||||
-rw-r--r-- | src/GuiLua/test.lua | 2 | ||||
-rw-r--r-- | src/GuiLua/test.skang | 6 |
4 files changed, 7 insertions, 5 deletions
diff --git a/lib/skang.lua b/lib/skang.lua index e44d4bc..8de692e 100644 --- a/lib/skang.lua +++ b/lib/skang.lua | |||
@@ -117,6 +117,8 @@ moduleBegin = function (name, author, copyright, version, timestamp, skin, isLua | |||
117 | end | 117 | end |
118 | 118 | ||
119 | _M._M = _M -- So that references to _M below the setfenv() actually go to the real _M. | 119 | _M._M = _M -- So that references to _M below the setfenv() actually go to the real _M. |
120 | --[[ TODO - Check if it exists before doing this, or could override standard Lua stuff. ]] | ||
121 | _M[name] = _M -- So that the module can refer to itself internally. | ||
120 | _M._NAME = name | 122 | _M._NAME = name |
121 | _M._PACKAGE = string.gsub(_M._NAME, "[^.]*$", "") -- Strip the name down to the package name. | 123 | _M._PACKAGE = string.gsub(_M._NAME, "[^.]*$", "") -- Strip the name down to the package name. |
122 | _M.isLua = isLua | 124 | _M.isLua = isLua |
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c index 3ef6007..57fa09c 100644 --- a/src/GuiLua/GuiLua.c +++ b/src/GuiLua/GuiLua.c | |||
@@ -165,7 +165,7 @@ static void _on_click(void *data, Evas_Object *obj, void *event_info EINA_UNUSED | |||
165 | { | 165 | { |
166 | lua_State *L = wid->data; | 166 | lua_State *L = wid->data; |
167 | 167 | ||
168 | PD("Doing action %s", wid->action); | 168 | PD("Doing action '%s' for module %s", wid->action, wid->win->module); |
169 | doLuaString(L, wid->action, wid->win->module); | 169 | doLuaString(L, wid->action, wid->win->module); |
170 | } | 170 | } |
171 | } | 171 | } |
diff --git a/src/GuiLua/test.lua b/src/GuiLua/test.lua index ee007ea..7fe2e52 100644 --- a/src/GuiLua/test.lua +++ b/src/GuiLua/test.lua | |||
@@ -2,7 +2,7 @@ | |||
2 | -- By virtue of the fact we are stuffing our result into package.loaded[], just plain running this works as "loading the module". | 2 | -- By virtue of the fact we are stuffing our result into package.loaded[], just plain running this works as "loading the module". |
3 | do -- Only I'm not gonna indent this. | 3 | do -- Only I'm not gonna indent this. |
4 | 4 | ||
5 | local skang = require 'skang' | 5 | skang = require 'skang' |
6 | local _M = skang.moduleBegin('test', nil, 'Copyright 2014 David Seikel', '0.1', '2014-03-27 03:57:00', [[ | 6 | local _M = skang.moduleBegin('test', nil, 'Copyright 2014 David Seikel', '0.1', '2014-03-27 03:57:00', [[ |
7 | local win = skang.window(200, 100, "G'day planet.", 'testWindow') | 7 | local win = skang.window(200, 100, "G'day planet.", 'testWindow') |
8 | skang.thingasm{win, 'quitter', 'Quits the skang window', types = 'widget', widget='"button", "Quit", 10, 10, 100, 30'} | 8 | skang.thingasm{win, 'quitter', 'Quits the skang window', types = 'widget', widget='"button", "Quit", 10, 10, 100, 30'} |
diff --git a/src/GuiLua/test.skang b/src/GuiLua/test.skang index e3b303b..6346a4a 100644 --- a/src/GuiLua/test.skang +++ b/src/GuiLua/test.skang | |||
@@ -1,14 +1,14 @@ | |||
1 | #!/usr/bin/env skang -l test -- Lua allows this shell hack. | 1 | #!/usr/bin/env skang -l test -- Lua allows this shell hack. |
2 | 2 | ||
3 | -- There's an implied local skang = require 'skang' | 3 | -- There's an implied skang = require 'skang' |
4 | -- There's an implied local test = require 'test' | 4 | -- There's an implied test = require 'test' |
5 | 5 | ||
6 | -- This is a bit more verbose than I wanted. lol | 6 | -- This is a bit more verbose than I wanted. lol |
7 | local win = skang.window(200, 100, "G'day planet.", 'testWindow') | 7 | local win = skang.window(200, 100, "G'day planet.", 'testWindow') |
8 | skang.thingasm{win, 'quitter', 'Quits the skang window', types = 'widget', widget='"button", "Quit", 10, 10, 100, 30'} | 8 | skang.thingasm{win, 'quitter', 'Quits the skang window', types = 'widget', widget='"button", "Quit", 10, 10, 100, 30'} |
9 | win.W.quitter.action = 'skang.quit()' -- TODO Should look it up in ThingSpace.commands, and translate 'quit' into the Lua 'skang.quit()'? | 9 | win.W.quitter.action = 'skang.quit()' -- TODO Should look it up in ThingSpace.commands, and translate 'quit' into the Lua 'skang.quit()'? |
10 | 10 | ||
11 | skang.thingasm{win, 'ffuncer', 'Calls ffunc', types = 'widget', widget='"button", "ffunc()", 10, 40, 100, 30', action='test.ffunc(3, 4)'} | 11 | skang.thingasm{win, 'ffuncer', 'Calls ffunc', types = 'widget', widget='"button", "ffunc()", 10, 40, 100, 30', action='ffunc(3, 4)'} |
12 | 12 | ||
13 | test.bar = 'things' | 13 | test.bar = 'things' |
14 | test.ffunc(1, 'two') | 14 | test.ffunc(1, 'two') |