Skip to content

Commit a8a35cb

Browse files
committed
Revert "fix(5.0): prevent the string passed to luaL_loadbuffer from being truncated"
This reverts commit b1ee428.
1 parent b1ee428 commit a8a35cb

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/binding-factory.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,12 @@ const lauxBindings: Record<string, lauxBindingFactoryFunc> = {
167167
luaL_loadstring: function(L: LuaState, s: string) {
168168
return (this as LauxLib).luaL_loadbuffer(L, s, s.length, s);
169169
},
170-
luaL_loadbuffer: function(L: LuaState, s: string, slen: number, name: string) {
171-
// Terrible, awful hack to prevent the end of the string from being mangled by the C wrapper
172-
const pad = " ";
173-
const loadbuffer = luaGlue.cwrap("luaL_loadbuffer", "number", ["number", "string", "number", "string"]);
174-
return loadbuffer(L, s + pad, slen + pad.length, name);
175-
},
176170
luaL_newstate: luaGlue.cwrap("lua_open", "number", []),
177171
}
178172
},
179-
"5.1.x": function(luaGlue: LuaEmscriptenModule, _lua: Lua) {
173+
"<=5.1.x": function(luaGlue: LuaEmscriptenModule, _lua: Lua) {
180174
return {
181-
luaL_loadbuffer: luaGlue.cwrap("luaL_loadbuffer", "number", ["number", "string", "number", "string"])
175+
luaL_loadbuffer: luaGlue.cwrap("luaL_loadbuffer", "number", ["number", "string", "number", "string"]),
182176
}
183177
},
184178
">=5.1.0": function(luaGlue: LuaEmscriptenModule, lua: Lua) {

0 commit comments

Comments
 (0)