Fix broken LFS loading in Lua 5.3.

Do not [lua_]assert() on things which have a side effect...
This commit is contained in:
Johny Mattsson 2021-08-30 16:49:23 +10:00
parent 185855b69a
commit d66473aeeb
1 changed files with 3 additions and 2 deletions

View File

@ -579,9 +579,10 @@ static void LoadAllProtos (LoadState *S) {
S->pv[i] = LoadFunction(S, luaF_newproto(L), NULL);
}
/* generate the ROTable entries from first N constants; the last is a timestamp */
lua_assert(n+1 == LoadInt(S));
int nk = LoadInt(S);
lua_assert(n+1 == nk);
ROTable_entry *entry_list = cast(ROTable_entry *, StoreGetPos(S));
for (i = 0; i < n; i++) {
for (i = 0; i < nk - 1; i++) { // -1 to ignore timestamp
lu_byte tt_data = LoadByte(S);
TString *Tname = LoadString2(S, tt_data);
const char *name = getstr(Tname) + OFFSET_TSTRING;