@@ -68,6 +68,10 @@ const luaBindings: Record<string, luaBindingFactoryFunc> = {
6868 } ,
6969 "<=5.1.x" : function ( luaGlue : LuaEmscriptenModule ) {
7070 return {
71+ lua_call : luaGlue . cwrap ( "lua_call" , "number" , [ "number" , "number" , "number" ] ) ,
72+ lua_callk : function ( _L : LuaState , _nargs : number , _nresults : number , _ctx : number , _k : number ) {
73+ throw "callk not supported with Lua 5.1 and lower" ;
74+ } ,
7175 // Need to overwrite because in lua 5.1 this is a function and not a #define (5.2 and higher)
7276 lua_pcall : luaGlue . cwrap ( "lua_pcall" , "number" , [ "number" , "number" , "number" , "number" ] ) ,
7377 // TODO there might be some way to mimic pcallk behaviour with 5.1 somehow
@@ -90,6 +94,10 @@ const luaBindings: Record<string, luaBindingFactoryFunc> = {
9094 } ,
9195 ">=5.2.0" : function ( luaGlue : LuaEmscriptenModule ) {
9296 return {
97+ lua_call : function ( L : LuaState , nargs : number , nresults : number ) {
98+ return ( this as Lua ) . lua_callk ( L , nargs , nresults , 0 , 0 ) ;
99+ } ,
100+ lua_callk : luaGlue . cwrap ( "lua_callk" , "number" , [ "number" , "number" , "number" , "number" , "number" ] ) ,
93101 lua_getglobal : luaGlue . cwrap ( "lua_getglobal" , "number" , [ "number" , "string" ] ) ,
94102 lua_pcall : function ( L : LuaState , nargs : number , nresults : number , msgh : number ) {
95103 return ( this as Lua ) . lua_pcallk ( L , nargs , nresults , msgh , 0 , 0 ) ;
0 commit comments