Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Pokes_Icons = {
- ["Bulbasaur"] = {
- on = 12906,
- off = 12908,
- used = 12907,
- }
- }
- enum Pokes_Stats_t
- {
- OFFENSE = 0,
- DEFENSE,
- SPECIALATTACK,
- SPECIALDEFENSE,
- VITALITY,
- AGILITY,
- ICONON,
- ICONOFF,
- ICONUSE,
- TYPEONE,
- TYPETWO
- };
- std::map <std::string, std::map <Pokes_Stats_t, int32_t> > pokeStat;
- bool loadPokes(){
- lua_State* L = lua_open();
- std::string pokeName = "";
- if(!L){
- return false;
- }
- if(luaL_dofile(L, "Poke_Config.lua"))
- {
- lua_getglobal(L, "Pokes_Icons");
- lua_pushnil(L);
- while(lua_next(L, -2) != 0) {
- if(lua_istable(L, -1) && lua_isstring(L, -2)){
- pokeName = lua_tostring(L, -2);
- lua_pushnil(L);
- while(lua_next(L, -2) != 0) {
- if(lua_isnumber(L, -1) && lua_isstring(L, -2)){
- if(lua_tostring(L, -2) == "on"){
- pokeStat[pokeName][ICONON] = (int32_t)lua_tonumber(L, -1);
- }else if(lua_tostring(L, -2) == "off"){
- pokeStat[pokeName][ICONOFF] = (int32_t)lua_tonumber(L, -1);
- }else if(lua_tostring(L, -2) == "used"){
- pokeStat[pokeName][ICONUSE] = (int32_t)lua_tonumber(L, -1);
- }
- }
- lua_pop(L, 1);
- }
- }
- lua_pop(L, 1);
- }
- }
- lua_pop(L, 1);
- std::cout << pokeName << ": " << pokeStat["Bulbasaur"][ICONUSE] << std::endl;
- if(L)
- lua_close(L);
- }
- Bulbasaur: 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement