aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ClientHamr/GuiLua/test_c.c
diff options
context:
space:
mode:
Diffstat (limited to 'ClientHamr/GuiLua/test_c.c')
-rw-r--r--ClientHamr/GuiLua/test_c.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/ClientHamr/GuiLua/test_c.c b/ClientHamr/GuiLua/test_c.c
index 37b5c76..5328bda 100644
--- a/ClientHamr/GuiLua/test_c.c
+++ b/ClientHamr/GuiLua/test_c.c
@@ -55,36 +55,34 @@ int luaopen_test_c(lua_State *L)
55 55
56// local skang = require 'skang' 56// local skang = require 'skang'
57 lua_getglobal(L, "require"); 57 lua_getglobal(L, "require");
58 lua_pushstring(L, "skang"); 58 lua_pushstring(L, SKANG);
59 lua_call(L, 1, 1); 59 lua_call(L, 1, 1);
60 lua_setfield(L, LUA_REGISTRYINDEX, SKANG);
61 lua_getfield(L, LUA_REGISTRYINDEX, SKANG);
60 skang = lua_gettop(L); 62 skang = lua_gettop(L);
61 63
62 lua_setfield(L, LUA_REGISTRYINDEX, "skang");
63 lua_getfield(L, LUA_REGISTRYINDEX, "skang");
64
65// local _M = skang.moduleBegin('test_c', nil, 'Copyright 2014 David Seikel', '0.1', '2014-03-27 03:57:00', nil, false) 64// local _M = skang.moduleBegin('test_c', nil, 'Copyright 2014 David Seikel', '0.1', '2014-03-27 03:57:00', nil, false)
66 push_lua(L, "@ ( $ ~ $ $ $ ~ ! )", skang, "moduleBegin", ourName, "Copyright 2014 David Seikel", "0.1", "2014-03-27 03:57:00", 0, 1); 65 push_lua(L, "@ ( $ ~ $ $ $ ~ ! )", skang, MODULEBEGIN, ourName, "Copyright 2014 David Seikel", "0.1", "2014-03-27 03:57:00", 0, 1);
67 _M = lua_gettop(L);
68
69 // Save this module in the C registry.
70 lua_setfield(L, LUA_REGISTRYINDEX, ourName); 66 lua_setfield(L, LUA_REGISTRYINDEX, ourName);
71 lua_getfield(L, LUA_REGISTRYINDEX, ourName); 67 lua_getfield(L, LUA_REGISTRYINDEX, ourName);
68 _M = lua_gettop(L);
72 69
73// This uses function{} style. 70// This uses function{} style.
74// skang.thingasm{_M, 'cfooble,c', 'cfooble help text', 1, widget=\"'edit', 'The cfooble:', 1, 1, 10, 50\", required=true} 71// skang.thingasm{_M, 'cfooble,c', 'cfooble help text', 1, widget=\"'edit', 'The cfooble:', 1, 1, 10, 50\", required=true}
75 push_lua(L, "@ ( { @ $ $ % $widget !required } )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "cfooble,c", "cfooble help text", 1, "'edit', 'The cfooble:', 1, 1, 10, 50", 1, 0); 72 push_lua(L, "@ ( { = $ $ % $widget !required } )", skang, THINGASM, _M, "cfooble,c", "cfooble help text", 1, "'edit', 'The cfooble:', 1, 1, 10, 50", 1, 0);
76 73
77// skang.thing(_M, 'cbar', 'Help text', 'Default') 74// skang.thing(_M, 'cbar', 'Help text', 'Default')
78 push_lua(L, "@ ( @ $ $ $ )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "cbar", "Help text", "Default", 0); 75 push_lua(L, "@ ( = $ $ $ )", skang, THINGASM, _M, "cbar", "Help text", "Default", 0);
79 76
80// skang.thingasm(_M, 'cfoo') 77// skang.thingasm(_M, 'cfoo')
81 push_lua(L, "@ ( @ $ )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "cfoo", 0); 78 push_lua(L, "@ ( = $ )", skang, THINGASM, _M, "cfoo", 0);
82 79
83// skang.thingasm(_M, 'cfunc', 'cfunc does nothing really', cfunc, 'number,string') 80// skang.thingasm(_M, 'cfunc', 'cfunc does nothing really', cfunc, 'number,string')
84 push_lua(L, "@ ( @ $ $ & $ )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "cfunc", "cfunc does nothing really", cfunc, "number,string", 0); 81 push_lua(L, "@ ( = $ $ & $ )", skang, THINGASM, _M, "cfunc", "cfunc does nothing really", cfunc, "number,string", 0);
85 82
86// skang.moduleEnd(_M) 83// skang.moduleEnd(_M)
87 push_lua(L, "@ ( @ )", skang, "moduleEnd", LUA_REGISTRYINDEX, ourName, 0); 84 push_lua(L, "@ ( = )", skang, MODULEEND, _M, 0);
88 85
86 // Return _M, the table itself, not the index.
89 return 1; 87 return 1;
90} 88}