Get rid of getfield/setfield
This commit is contained in:
@@ -48,10 +48,10 @@ void LuaStack::register_all_userdata(lua_State *L) {
|
||||
LS.set(classname, name);
|
||||
if (mode.find('t') != std::string::npos) { // Register type
|
||||
LS.newtable(tab);
|
||||
LS.setfield(tab, "type", name);
|
||||
LS.setfield(tab, "__gc", collect_tagged_pointer);
|
||||
LS.rawset(tab, "type", name);
|
||||
LS.rawset(tab, "__gc", collect_tagged_pointer);
|
||||
LS.makeclass(classtab, classname);
|
||||
LS.setfield(tab, "__index", classtab);
|
||||
LS.rawset(tab, "__index", classtab);
|
||||
LS.setlightuserdata(lud, (void *)tag);
|
||||
LS.rawset(LuaRegistry, lud, tab);
|
||||
}
|
||||
@@ -216,8 +216,8 @@ void LuaStack::makeclass(LuaSlot classtab, LuaSlot classname) const {
|
||||
}
|
||||
|
||||
// Repair the special fields.
|
||||
setfield(classtab, "__index", classtab);
|
||||
setfield(classtab, "__class", classname);
|
||||
rawset(classtab, "__index", classtab);
|
||||
rawset(classtab, "__class", classname);
|
||||
}
|
||||
|
||||
void LuaStack::makesubtable(LuaSlot sub, LuaSlot tab, const char *name) const {
|
||||
@@ -254,7 +254,7 @@ LuaDefine(system_type, "f") {
|
||||
int type = LS.type(obj);
|
||||
if (type == LUA_TUSERDATA) {
|
||||
LS.getmetatable(mt, obj);
|
||||
LS.getfield(tname, mt, "type");
|
||||
LS.rawget(tname, mt, "type");
|
||||
} else {
|
||||
LS.set(tname, lua_typename(L, type));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user