Skip to content

Commit 55b76df

Browse files
authored
Merge pull request #6 from pilaoda/master
add lua_gettop api
2 parents c4060c9 + 39024f2 commit 55b76df

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

scripts/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ if [[ "$1" == "lua-5.0.3" ]]; then
3232
'_luaL_loadbuffer', \
3333
'_lua_close', \
3434
'_lua_gettable', \
35+
'_lua_gettop', \
3536
'_lua_insert', \
3637
'_lua_isstring', \
3738
'_lua_open', \
@@ -71,6 +72,7 @@ elif [[ "$1" == "lua-5.1.5" ]]; then
7172
'_lua_close', \
7273
'_lua_getfield', \
7374
'_lua_gettable', \
75+
'_lua_gettop', \
7476
'_lua_insert', \
7577
'_lua_isstring', \
7678
'_lua_pcall', \
@@ -110,6 +112,7 @@ elif [[ "$1" == "lua-5.2.4" ]]; then
110112
'_lua_getfield', \
111113
'_lua_getglobal', \
112114
'_lua_gettable', \
115+
'_lua_gettop', \
113116
'_lua_insert', \
114117
'_lua_isstring', \
115118
'_lua_pcallk', \
@@ -150,6 +153,7 @@ else
150153
'_lua_getfield', \
151154
'_lua_getglobal', \
152155
'_lua_gettable', \
156+
'_lua_gettop', \
153157
'_lua_isstring', \
154158
'_lua_pcallk', \
155159
'_lua_pushstring', \

src/binding-factory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const luaBindings: Record<string, luaBindingFactoryFunc> = {
88
return {
99
lua_close: luaGlue.cwrap("lua_close", null, ["number"]),
1010
lua_gettable: luaGlue.cwrap("lua_gettable", "number", ["number", "number"]),
11+
lua_gettop: luaGlue.cwrap("lua_gettop", "number", ["number"]),
1112
lua_isstring: luaGlue.cwrap("lua_isstring", "number", ["number", "number"]),
1213
// #define in all versions
1314
lua_pop: function(L: LuaState, n: number) {

src/lua.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export interface Lua {
2929
lua_getglobal(L: LuaState, name: string): number;
3030
// TODO returns int in some lua versions void in others
3131
lua_gettable(L: LuaState, index: number): number;
32+
lua_gettop(L: LuaState): number;
3233
lua_insert(L: LuaState, index: number): void;
3334
lua_isstring(L: LuaState, index: number): number;
3435
lua_pcall(L: LuaState, nargs: number, nresults: number, msgh: number): number;

0 commit comments

Comments
 (0)