mirror of
https://github.com/devZoGok/gameBase.git
synced 2026-08-26 19:43:28 +00:00
added string extraction method
This commit is contained in:
@@ -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<Index> &indices){
|
||||
lua_getglobal(state, table.c_str());
|
||||
|
||||
|
||||
@@ -29,12 +29,15 @@ namespace gameBase{
|
||||
bool getBoolFromTable(std::string, std::vector<Index>);
|
||||
float getFloatFromTable(std::string, std::vector<Index>);
|
||||
std::string getStringFromTable(std::string, std::vector<Index>);
|
||||
std::string getString(std::string);
|
||||
private:
|
||||
LuaManager();
|
||||
void prepareTableForRetrieval(std::string, std::vector<Index>&);
|
||||
|
||||
lua_State *state = nullptr;
|
||||
};
|
||||
|
||||
typedef LuaManager::Index Index;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user