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:
3
lvm.c
3
lvm.c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user