summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinclude/luaglue/LuaVM.hpp1
-rw-r--r--src/libluaglue/LuaVM.cpp12
2 files changed, 13 insertions, 0 deletions
diff --git a/include/luaglue/LuaVM.hpp b/include/luaglue/LuaVM.hpp
index 81261f3..6055fd4 100755
--- a/include/luaglue/LuaVM.hpp
+++ b/include/luaglue/LuaVM.hpp
@@ -27,6 +27,7 @@ class LuaVM
LUAGLUE_DLL_VISIBLE std::string getString( const std::string &key );
LUAGLUE_DLL_VISIBLE std::vector<std::string> getStringArray( const std::string &key );
+ LUAGLUE_DLL_VISIBLE int getInt( const std::string &key );
LUAGLUE_DLL_VISIBLE bool getBoolean( const std::string &key );
LUAGLUE_DLL_VISIBLE lua_State *handle( );
diff --git a/src/libluaglue/LuaVM.cpp b/src/libluaglue/LuaVM.cpp
index 566e516..9764707 100644
--- a/src/libluaglue/LuaVM.cpp
+++ b/src/libluaglue/LuaVM.cpp
@@ -262,6 +262,18 @@ string LuaVM::getString( const string &key )
return res;
}
+int LuaVM::getInt( const std::string &key )
+{
+ int n = findValue( key );
+
+ int res = lua_tointeger( m_lua, -1 );
+ lua_pop( m_lua, n );
+
+ //dumpStack( );
+
+ return res;
+}
+
bool LuaVM::getBoolean( const string &key )
{
int n = findValue( key );