def type(self, idx): if self.stack.is_valid(idx): return LuaValue.type_of(self.stack.get(idx)) return LuaType.NONE
def get_i(self, idx, i): t = self.stack.get(idx) v = LuaState.get_table_val(t, i) self.stack.push(v) return LuaValue.type_of(v)
def get_metatable_k(self, val): if isinstance(val, LuaTable): return val.metatable else: key = '_MT' + str(LuaValue.type_of(val)) return self.registry.get(key)
def get_table(self, idx): t = self.stack.get(idx) k = self.stack.pop() v = LuaState.get_table_val(t, k) self.stack.push(v) return LuaValue.type_of(v)
def set_metatable_kv(self, val, mt): if isinstance(val, LuaTable): val.metatable = mt else: key = '_MT' + LuaValue.type_of(val) self.registry.put(key, mt)