@@ -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
@@ -78,6 +82,10 @@ const luaBindings: Record<string, luaBindingFactoryFunc> = {
7882 } ,
7983 ">=5.1.0" : function ( luaGlue : LuaEmscriptenModule ) {
8084 return {
85+ lua_call : function ( L : LuaState , nargs : number , nresults : number ) {
86+ return ( this as Lua ) . lua_callk ( L , nargs , nresults , 0 , 0 ) ;
87+ } ,
88+ lua_callk : luaGlue . cwrap ( "lua_callk" , "number" , [ "number" , "number" , "number" , "number" , "number" ] ) ,
8189 lua_getfield : luaGlue . cwrap ( "lua_getfield" , "number" , [ "number" , "number" , "string" ] ) ,
8290 lua_setfield : luaGlue . cwrap ( "lua_setfield" , null , [ "number" , "number" , "string" ] ) ,
8391 // TODO 3rd param is a output param (currently ignored)
0 commit comments