aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ClientHamr/GuiLua/test_c.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-03-31 22:00:53 +1000
committerDavid Walter Seikel2014-03-31 22:00:53 +1000
commitf2c5263901f7ca287b8b322ae8ecaf0a5b24ff72 (patch)
treecc32f9084fd80e130efd5c60e150d65bf17379b3 /ClientHamr/GuiLua/test_c.c
parentNotes++ (diff)
downloadSledjHamr-f2c5263901f7ca287b8b322ae8ecaf0a5b24ff72.zip
SledjHamr-f2c5263901f7ca287b8b322ae8ecaf0a5b24ff72.tar.gz
SledjHamr-f2c5263901f7ca287b8b322ae8ecaf0a5b24ff72.tar.bz2
SledjHamr-f2c5263901f7ca287b8b322ae8ecaf0a5b24ff72.tar.xz
More ways to call thing, and rename it thingasm.
Finally, a use for __call(). lol
Diffstat (limited to 'ClientHamr/GuiLua/test_c.c')
-rw-r--r--ClientHamr/GuiLua/test_c.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ClientHamr/GuiLua/test_c.c b/ClientHamr/GuiLua/test_c.c
index 47cb72d..10af91c 100644
--- a/ClientHamr/GuiLua/test_c.c
+++ b/ClientHamr/GuiLua/test_c.c
@@ -120,7 +120,8 @@ int luaopen_test_c(lua_State *L)
120// http://www.lua.org/pil/25.3.html seems the most reasonable of the examples I've found. 120// http://www.lua.org/pil/25.3.html seems the most reasonable of the examples I've found.
121 121
122// skang.thing('cfooble,c', 'Help text goes here', 1, 'number', \"'edit', 'The fooble:', 1, 1, 10, 50\", true) 122// skang.thing('cfooble,c', 'Help text goes here', 1, 'number', \"'edit', 'The fooble:', 1, 1, 10, 50\", true)
123 lua_getfield(L, skang, "thing"); 123 lua_getfield(L, skang, "thingasm");
124 lua_getfield(L, LUA_REGISTRYINDEX, ourName); // Coz getfenv() can't find C environment.
124 lua_pushstring(L, "cfooble,c"); 125 lua_pushstring(L, "cfooble,c");
125 lua_pushstring(L, "Help text"); 126 lua_pushstring(L, "Help text");
126 lua_pushnumber(L, 1); 127 lua_pushnumber(L, 1);
@@ -129,11 +130,11 @@ int luaopen_test_c(lua_State *L)
129 lua_pushboolean(L, 1); // Is required. 130 lua_pushboolean(L, 1); // Is required.
130 lua_pushnil(L); // Default ACL. 131 lua_pushnil(L); // Default ACL.
131 lua_pushnil(L); // No boss. 132 lua_pushnil(L); // No boss.
132 lua_getfield(L, LUA_REGISTRYINDEX, ourName); // Coz getfenv() can't find C environment.
133 lua_call(L, 9, 0); 133 lua_call(L, 9, 0);
134 134
135// skang.thing('cbar', 'Help text', 'Default') 135// skang.thing('cbar', 'Help text', 'Default')
136 lua_getfield(L, skang, "thing"); 136 lua_getfield(L, skang, "thingasm");
137 lua_getfield(L, LUA_REGISTRYINDEX, ourName); // Coz getfenv() can't find C environment.
137 lua_pushstring(L, "cbar"); 138 lua_pushstring(L, "cbar");
138 lua_pushstring(L, "Help text"); 139 lua_pushstring(L, "Help text");
139 lua_pushstring(L, "Default"); 140 lua_pushstring(L, "Default");
@@ -142,11 +143,10 @@ int luaopen_test_c(lua_State *L)
142 lua_pushnil(L); // Not required. 143 lua_pushnil(L); // Not required.
143 lua_pushnil(L); // Default ACL. 144 lua_pushnil(L); // Default ACL.
144 lua_pushnil(L); // No boss. 145 lua_pushnil(L); // No boss.
145 lua_getfield(L, LUA_REGISTRYINDEX, ourName); // Coz getfenv() can't find C environment.
146 lua_call(L, 9, 0); 146 lua_call(L, 9, 0);
147 147
148// skang.thing('cfoo') 148// skang.thing('cfoo')
149 lua_getfield(L, skang, "thing"); 149 lua_getfield(L, skang, "thingasm");
150 lua_pushstring(L, "cfoo"); 150 lua_pushstring(L, "cfoo");
151 lua_pushnil(L); // No help. 151 lua_pushnil(L); // No help.
152 lua_pushnil(L); // No default. 152 lua_pushnil(L); // No default.
@@ -159,7 +159,8 @@ int luaopen_test_c(lua_State *L)
159 lua_call(L, 9, 0); 159 lua_call(L, 9, 0);
160 160
161// skang.thing('cfunc', 'Help Text', ffunc, 'number,string') 161// skang.thing('cfunc', 'Help Text', ffunc, 'number,string')
162 lua_getfield(L, skang, "thing"); 162 lua_getfield(L, skang, "thingasm");
163 lua_getfield(L, LUA_REGISTRYINDEX, ourName); // Coz getfenv() can't find C environment.
163 lua_pushstring(L, "cfunc"); 164 lua_pushstring(L, "cfunc");
164 lua_pushstring(L, "cfunc does nothing really"); 165 lua_pushstring(L, "cfunc does nothing really");
165 lua_pushcfunction(L, cfunc); 166 lua_pushcfunction(L, cfunc);
@@ -168,7 +169,6 @@ int luaopen_test_c(lua_State *L)
168 lua_pushnil(L); // Not required. 169 lua_pushnil(L); // Not required.
169 lua_pushnil(L); // Default ACL. 170 lua_pushnil(L); // Default ACL.
170 lua_pushnil(L); // No boss. 171 lua_pushnil(L); // No boss.
171 lua_getfield(L, LUA_REGISTRYINDEX, ourName); // Coz getfenv() can't find C environment.
172 lua_call(L, 9, 0); 172 lua_call(L, 9, 0);
173 173
174// skang.moduleEnd(_M) 174// skang.moduleEnd(_M)