diff --git a/luaManager.cpp b/luaManager.cpp index 88297e3..5f486c2 100644 --- a/luaManager.cpp +++ b/luaManager.cpp @@ -36,6 +36,14 @@ namespace gameBase{ return var; } + string LuaManager::getString(string varName){ + lua_getglobal(state, varName.c_str()); + string result = lua_tostring(state, -1); + lua_pop(state, 1); + + return result; + } + void LuaManager::prepareTableForRetrieval(string table, vector &indices){ lua_getglobal(state, table.c_str()); diff --git a/luaManager.h b/luaManager.h index fd1b146..f74cf8f 100644 --- a/luaManager.h +++ b/luaManager.h @@ -29,12 +29,15 @@ namespace gameBase{ bool getBoolFromTable(std::string, std::vector); float getFloatFromTable(std::string, std::vector); std::string getStringFromTable(std::string, std::vector); + std::string getString(std::string); private: LuaManager(); void prepareTableForRetrieval(std::string, std::vector&); lua_State *state = nullptr; }; + + typedef LuaManager::Index Index; } #endif