Remove integer keys from lush table, use string lookups (issue #29)

VM now resolves lush functions via luaH_getshortstr through interned
TString pointers, so wrapping lush.command = my_wrapper is transparently
picked up. The lush table no longer has integer-keyed duplicates.
This commit is contained in:
Cormac Shannon
2026-03-20 21:32:38 +00:00
parent 5c1eca312f
commit e115a061bc
4 changed files with 15 additions and 13 deletions

3
lvm.c
View File

@@ -30,6 +30,7 @@
#include "ltable.h"
#include "ltm.h"
#include "lvm.h"
#include "lcmd.h"
/*
@@ -1947,7 +1948,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
lu_byte tag = luaH_getint(regt, LUA_RIDX_LUSH, &lushtv);
if (novariant(tag) == LUA_TTABLE) {
TValue func;
luaH_getint(hvalue(&lushtv), idx + 1, &func); /* 1-based */
luaH_getshortstr(hvalue(&lushtv), lushname[idx], &func);
setobj2s(L, ra, &func);
}
vmbreak;