new method

This commit is contained in:
devZoGok
2022-11-27 19:44:54 +02:00
parent a5dea4c5bd
commit 4c096a03d6
2 changed files with 9 additions and 0 deletions
+8
View File
@@ -36,6 +36,14 @@ namespace gameBase{
return var;
}
float LuaManager::getFloat(string varName){
lua_getglobal(state, varName.c_str());
int isNum;
float var = (int)lua_tonumberx(state, -1, &isNum);
lua_pop(state, 1);
return var;
}
string LuaManager::getString(string varName){
lua_getglobal(state, varName.c_str());
string result = lua_tostring(state, -1);
+1
View File
@@ -35,6 +35,7 @@ namespace gameBase{
inline lua_State* getState(){return state;}
void buildScript(std::vector<std::string>);
int getInt(std::string);
float getFloat(std::string);
int getIntFromTable(std::string, std::vector<Index>);
bool getBoolFromTable(std::string, std::vector<Index>);
float getFloatFromTable(std::string, std::vector<Index>);