Skip to content

Commit 00aae45

Browse files
committed
fix: account for the lack of luaL_dostring
1 parent 3f3be8d commit 00aae45

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/binding-factory.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,11 @@ export function createLua(luaGlue: LuaEmscriptenModule, version: string): Lua {
157157

158158
type lauxBindingFactoryFunc = (luaGlue: LuaEmscriptenModule, lua: Lua) => Partial<LauxLib>;
159159
const lauxBindings: Record<string, lauxBindingFactoryFunc> = {
160-
"5.0.x": function(luaGlue: LuaEmscriptenModule, _lua: Lua) {
160+
"5.0.x": function(luaGlue: LuaEmscriptenModule, lua: Lua) {
161161
return {
162-
luaL_dostring: luaGlue.cwrap("luaL_dostring", "number", ["number", "string"]),
162+
luaL_dostring: function(L: LuaState, s: string) {
163+
return (this as LauxLib).luaL_loadstring(L, s) || lua.lua_pcall(L, 0, LUA_MULTRET, 0);
164+
},
163165
luaL_loadstring: function(L: LuaState, s: string) {
164166
return (this as LauxLib).luaL_loadbuffer(L, s, s.length, s);
165167
},

0 commit comments

Comments
 (0)