diff options
author | David Walter Seikel | 2014-04-03 03:57:45 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-04-03 03:57:45 +1000 |
commit | a48707187c17001e0cea25da12c3e338eae725f3 (patch) | |
tree | c8106668a10689d13f00a7a964a35b763b0685b2 | |
parent | Shuffle same docs around, and fix up others. (diff) | |
download | SledjHamr-a48707187c17001e0cea25da12c3e338eae725f3.zip SledjHamr-a48707187c17001e0cea25da12c3e338eae725f3.tar.gz SledjHamr-a48707187c17001e0cea25da12c3e338eae725f3.tar.bz2 SledjHamr-a48707187c17001e0cea25da12c3e338eae725f3.tar.xz |
Fix up the commented version of the function calls.
Diffstat (limited to '')
-rw-r--r-- | ClientHamr/GuiLua/test_c.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ClientHamr/GuiLua/test_c.c b/ClientHamr/GuiLua/test_c.c index 3949012..eba9b38 100644 --- a/ClientHamr/GuiLua/test_c.c +++ b/ClientHamr/GuiLua/test_c.c | |||
@@ -15,7 +15,6 @@ http://lua-users.org/lists/lua-l/2008-01/msg00671.html | |||
15 | 15 | ||
16 | #include <lua.h> | 16 | #include <lua.h> |
17 | #include <lauxlib.h> | 17 | #include <lauxlib.h> |
18 | //#include <lualib.h> | ||
19 | 18 | ||
20 | 19 | ||
21 | static const char *ourName = "test_c"; | 20 | static const char *ourName = "test_c"; |
@@ -88,7 +87,7 @@ int luaopen_test_c(lua_State *L) | |||
88 | skang = lua_gettop(L); | 87 | skang = lua_gettop(L); |
89 | // dumpStack(L, skang); | 88 | // dumpStack(L, skang); |
90 | 89 | ||
91 | // local _M = skang.moduleBegin('test_c', nil, 'Copyright 2014 David Seikel', '0.1', '2014-03-27 03:57:00', nil, true) | 90 | // local _M = skang.moduleBegin('test_c', nil, 'Copyright 2014 David Seikel', '0.1', '2014-03-27 03:57:00', nil, false) |
92 | lua_getfield(L, skang, "moduleBegin"); | 91 | lua_getfield(L, skang, "moduleBegin"); |
93 | lua_pushstring(L, ourName); | 92 | lua_pushstring(L, ourName); |
94 | lua_pushnil(L); // Author comes from copyright. | 93 | lua_pushnil(L); // Author comes from copyright. |
@@ -117,7 +116,8 @@ int luaopen_test_c(lua_State *L) | |||
117 | // TODO - This is too verbose. I've had an idea for writing some sort of generic wrapper, though others have done the same. | 116 | // TODO - This is too verbose. I've had an idea for writing some sort of generic wrapper, though others have done the same. |
118 | // http://www.lua.org/pil/25.3.html seems the most reasonable of the examples I've found. | 117 | // http://www.lua.org/pil/25.3.html seems the most reasonable of the examples I've found. |
119 | 118 | ||
120 | // skang.thing('cfooble,c', 'Help text goes here', 1, 'number', \"'edit', 'The fooble:', 1, 1, 10, 50\", true) | 119 | // This uses function{} style. |
120 | // skang.thingasm{_M, 'cfooble,c', 'cfooble help text', 1, widget=\"'edit', 'The fooble:', 1, 1, 10, 50\", required=true} | ||
121 | lua_getfield(L, skang, "thingasm"); | 121 | lua_getfield(L, skang, "thingasm"); |
122 | i = 1; | 122 | i = 1; |
123 | lua_newtable(L); | 123 | lua_newtable(L); |
@@ -143,7 +143,7 @@ int luaopen_test_c(lua_State *L) | |||
143 | lua_setfield(L, -2, "required"); | 143 | lua_setfield(L, -2, "required"); |
144 | lua_call(L, 1, 0); | 144 | lua_call(L, 1, 0); |
145 | 145 | ||
146 | // skang.thing('cbar', 'Help text', 'Default') | 146 | // skang.thing(_M, 'cbar', 'Help text', 'Default') |
147 | lua_getfield(L, skang, "thingasm"); | 147 | lua_getfield(L, skang, "thingasm"); |
148 | lua_getfield(L, LUA_REGISTRYINDEX, ourName); // Coz getfenv() can't find C environment. | 148 | lua_getfield(L, LUA_REGISTRYINDEX, ourName); // Coz getfenv() can't find C environment. |
149 | lua_pushstring(L, "cbar"); | 149 | lua_pushstring(L, "cbar"); |
@@ -151,13 +151,13 @@ int luaopen_test_c(lua_State *L) | |||
151 | lua_pushstring(L, "Default"); | 151 | lua_pushstring(L, "Default"); |
152 | lua_call(L, 4, 0); | 152 | lua_call(L, 4, 0); |
153 | 153 | ||
154 | // skang.thing('cfoo') | 154 | // skang.thingasm(_M, 'cfoo') |
155 | lua_getfield(L, skang, "thingasm"); | 155 | lua_getfield(L, skang, "thingasm"); |
156 | lua_getfield(L, LUA_REGISTRYINDEX, ourName); // Coz getfenv() can't find C environment. | 156 | lua_getfield(L, LUA_REGISTRYINDEX, ourName); // Coz getfenv() can't find C environment. |
157 | lua_pushstring(L, "cfoo"); | 157 | lua_pushstring(L, "cfoo"); |
158 | lua_call(L, 2, 0); | 158 | lua_call(L, 2, 0); |
159 | 159 | ||
160 | // skang.thing('cfunc', 'Help Text', ffunc, 'number,string') | 160 | // skang.thingasm(_M, 'cfunc', 'cfunc does nothing really', cfunc, 'number,string') |
161 | lua_getfield(L, skang, "thingasm"); | 161 | lua_getfield(L, skang, "thingasm"); |
162 | lua_getfield(L, LUA_REGISTRYINDEX, ourName); // Coz getfenv() can't find C environment. | 162 | lua_getfield(L, LUA_REGISTRYINDEX, ourName); // Coz getfenv() can't find C environment. |
163 | lua_pushstring(L, "cfunc"); | 163 | lua_pushstring(L, "cfunc"); |