diff options
| author | Alexander Gavrilov | 2012-06-17 14:26:27 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-06-17 14:26:27 +0400 |
| commit | fa41a27f2643afe8c8b601aab3e2ab3b1403411d (patch) | |
| tree | a5db6d98d7701860f6ca293f90a3f28a8b3ebeaa /library/LuaApi.cpp | |
| parent | 67536da2fe718b103f4200b95f00cd30000cb7ad (diff) | |
| download | dfhack-fa41a27f2643afe8c8b601aab3e2ab3b1403411d.tar.gz dfhack-fa41a27f2643afe8c8b601aab3e2ab3b1403411d.tar.bz2 dfhack-fa41a27f2643afe8c8b601aab3e2ab3b1403411d.tar.xz | |
Add an api function to get vtable address from version info.
Diffstat (limited to 'library/LuaApi.cpp')
| -rw-r--r-- | library/LuaApi.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index cdfd4789..631b3c49 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -1080,6 +1080,17 @@ static int internal_setAddress(lua_State *L) return 1; } +static int internal_getVTable(lua_State *L) +{ + const char *name = luaL_checkstring(L, 1); + uint32_t addr = (uint32_t)Core::getInstance().vinfo->getVTable(name); + if (addr) + lua_pushnumber(L, addr); + else + lua_pushnil(L); + return 1; +} + static int internal_getMemRanges(lua_State *L) { std::vector<DFHack::t_memrange> ranges; @@ -1200,6 +1211,7 @@ static int internal_diffscan(lua_State *L) static const luaL_Reg dfhack_internal_funcs[] = { { "getAddress", internal_getAddress }, { "setAddress", internal_setAddress }, + { "getVTable", internal_getVTable }, { "getMemRanges", internal_getMemRanges }, { "memmove", internal_memmove }, { "memcmp", internal_memcmp }, |
