Dump/undump reuse strings

A repeated string in a dump is represented as an index to its first
occurence, instead of another copy of the string.
This commit is contained in:
Roberto Ierusalimschy
2022-12-15 16:44:22 -03:00
parent 3e6818ca87
commit d70a0c91ad
5 changed files with 77 additions and 12 deletions

View File

@@ -239,6 +239,7 @@ static int str_dump (lua_State *L) {
if (l_unlikely(lua_dump(L, writer, &state, strip) != 0))
return luaL_error(L, "unable to dump given function");
luaL_pushresult(&state.B);
lua_assert(lua_isfunction(L, 1)); /* lua_dump kept that value */
return 1;
}