Improvements to the pretty-printer
This commit is contained in:
@@ -257,7 +257,7 @@ void LuaStack::makeclass(LuaSlot tab, const std::string &name) const {
|
||||
lua_pop(L_, 1);
|
||||
}
|
||||
|
||||
std::string LuaStack::classname(LuaSlot tab) {
|
||||
std::string LuaStack::classname(LuaSlot tab) const {
|
||||
std::string result;
|
||||
if (istable(tab)) {
|
||||
lua_pushstring(L_, "__class");
|
||||
@@ -279,6 +279,22 @@ std::string LuaStack::classname(LuaSlot tab) {
|
||||
return result;
|
||||
}
|
||||
|
||||
int64_t LuaStack::tanid(LuaSlot tab) const {
|
||||
int64_t result = 0;
|
||||
if (istable(tab) && gettabletype(tab) == LUA_TT_TANGIBLE) {
|
||||
if (lua_getmetatable(L_, tab.index())) {
|
||||
lua_pushstring(L_, "id");
|
||||
lua_rawget(L_, -2);
|
||||
if (lua_type(L_, -1) == LUA_TNUMBER) {
|
||||
result = int64_t(lua_tonumber(L_, -1));
|
||||
}
|
||||
lua_pop(L_, 2);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void LuaStack::movesortablekey(LuaSlot key, LuaStack &otherstack, LuaSlot otherslot) {
|
||||
int type = lua_type(L_, key);
|
||||
switch (type) {
|
||||
|
||||
Reference in New Issue
Block a user