|
|
@ -96,6 +96,29 @@ int OffsetGroup::getParent(lua_State *L)
|
|
|
|
st.pcall(2,1);
|
|
|
|
st.pcall(2,1);
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int OffsetGroup::getKeys(lua_State *L)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
const char* invalids[]={"notset","invalid","valid"};
|
|
|
|
|
|
|
|
const char* keytypes[]={"offset","address","hexval","string","group"};
|
|
|
|
|
|
|
|
lua::state st(L);
|
|
|
|
|
|
|
|
std::vector<DFHack::OffsetKey> t= p->getKeys();
|
|
|
|
|
|
|
|
st.newtable();
|
|
|
|
|
|
|
|
for(size_t i=0;i<t.size();i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
st.push(i);
|
|
|
|
|
|
|
|
st.newtable();
|
|
|
|
|
|
|
|
st.push(invalids[t[i].inval]);
|
|
|
|
|
|
|
|
st.setfield("invalid");
|
|
|
|
|
|
|
|
st.push(t[i].key);
|
|
|
|
|
|
|
|
st.setfield("key");
|
|
|
|
|
|
|
|
st.push(keytypes[t[i].keytype]);//maybe use int...
|
|
|
|
|
|
|
|
st.setfield("keytype");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st.settable();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
IMP_LUNE(lua::OffsetGroup,OffsetGroup);
|
|
|
|
IMP_LUNE(lua::OffsetGroup,OffsetGroup);
|
|
|
|
LUNE_METHODS_START(lua::OffsetGroup)
|
|
|
|
LUNE_METHODS_START(lua::OffsetGroup)
|
|
|
@ -112,6 +135,7 @@ LUNE_METHODS_START(lua::OffsetGroup)
|
|
|
|
method(lua::OffsetGroup,getName),
|
|
|
|
method(lua::OffsetGroup,getName),
|
|
|
|
method(lua::OffsetGroup,getFullName),
|
|
|
|
method(lua::OffsetGroup,getFullName),
|
|
|
|
method(lua::OffsetGroup,getParent),
|
|
|
|
method(lua::OffsetGroup,getParent),
|
|
|
|
|
|
|
|
method(lua::OffsetGroup,getKeys),
|
|
|
|
LUNE_METHODS_END();
|
|
|
|
LUNE_METHODS_END();
|
|
|
|
// VersionInfo Stuff
|
|
|
|
// VersionInfo Stuff
|
|
|
|
static int __lua_getMD5(lua_State *S)
|
|
|
|
static int __lua_getMD5(lua_State *S)
|
|
|
@ -326,12 +350,23 @@ static int __lua_getHexValue(lua_State *S)
|
|
|
|
static int __lua_getGroup(lua_State *S)
|
|
|
|
static int __lua_getGroup(lua_State *S)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
lua::state st(S);
|
|
|
|
lua::state st(S);
|
|
|
|
DFHack::OffsetGroup* t= DFHack::Core::getInstance().vinfo->getGroup(st.as<std::string>(1));
|
|
|
|
if(st.as<std::string>(1)=="") //if no argument, return version info as a groupoffset (dynamic cast)
|
|
|
|
st.getglobal("OffsetGroup");
|
|
|
|
{
|
|
|
|
st.getfield("new");
|
|
|
|
st.getglobal("OffsetGroup");
|
|
|
|
st.getglobal("OffsetGroup");
|
|
|
|
st.getfield("new");
|
|
|
|
st.pushlightuserdata(t);
|
|
|
|
st.getglobal("OffsetGroup");
|
|
|
|
st.pcall(2,1);
|
|
|
|
st.pushlightuserdata(dynamic_cast<DFHack::OffsetGroup*>(DFHack::Core::getInstance().vinfo));
|
|
|
|
|
|
|
|
st.pcall(2,1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
DFHack::OffsetGroup* t= DFHack::Core::getInstance().vinfo->getGroup(st.as<std::string>(1));
|
|
|
|
|
|
|
|
st.getglobal("OffsetGroup");
|
|
|
|
|
|
|
|
st.getfield("new");
|
|
|
|
|
|
|
|
st.getglobal("OffsetGroup");
|
|
|
|
|
|
|
|
st.pushlightuserdata(t);
|
|
|
|
|
|
|
|
st.pcall(2,1);
|
|
|
|
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static int __lua_getParent(lua_State *S)
|
|
|
|
static int __lua_getParent(lua_State *S)
|
|
|
|