aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2015-03-22 17:35:10 +1000
committerDavid Walter Seikel2015-03-22 17:35:10 +1000
commitb75e596af61da88aa705491778a5fd6845ab43ba (patch)
tree1f969b3c4012ae0fb81ab7591ea559403efe855a
parentNew idea about contact sets. (diff)
downloadSledjHamr-b75e596af61da88aa705491778a5fd6845ab43ba.zip
SledjHamr-b75e596af61da88aa705491778a5fd6845ab43ba.tar.gz
SledjHamr-b75e596af61da88aa705491778a5fd6845ab43ba.tar.bz2
SledjHamr-b75e596af61da88aa705491778a5fd6845ab43ba.tar.xz
Add internal reference for skang modules, so they can find themselves.
-rw-r--r--lib/skang.lua2
-rw-r--r--src/GuiLua/GuiLua.c2
-rw-r--r--src/GuiLua/test.lua2
-rw-r--r--src/GuiLua/test.skang6
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".
3do -- Only I'm not gonna indent this. 3do -- Only I'm not gonna indent this.
4 4
5local skang = require 'skang' 5skang = 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 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
7local win = skang.window(200, 100, "G'day planet.", 'testWindow') 7local win = skang.window(200, 100, "G'day planet.", 'testWindow')
8skang.thingasm{win, 'quitter', 'Quits the skang window', types = 'widget', widget='"button", "Quit", 10, 10, 100, 30'} 8skang.thingasm{win, 'quitter', 'Quits the skang window', types = 'widget', widget='"button", "Quit", 10, 10, 100, 30'}
9win.W.quitter.action = 'skang.quit()' -- TODO Should look it up in ThingSpace.commands, and translate 'quit' into the Lua 'skang.quit()'? 9win.W.quitter.action = 'skang.quit()' -- TODO Should look it up in ThingSpace.commands, and translate 'quit' into the Lua 'skang.quit()'?
10 10
11skang.thingasm{win, 'ffuncer', 'Calls ffunc', types = 'widget', widget='"button", "ffunc()", 10, 40, 100, 30', action='test.ffunc(3, 4)'} 11skang.thingasm{win, 'ffuncer', 'Calls ffunc', types = 'widget', widget='"button", "ffunc()", 10, 40, 100, 30', action='ffunc(3, 4)'}
12 12
13test.bar = 'things' 13test.bar = 'things'
14test.ffunc(1, 'two') 14test.ffunc(1, 'two')