How to add this in .lua

Results 1 to 1 of 1
  1. #1
    Apprentice madman54 is offline
    MemberRank
    Apr 2020 Join Date
    14Posts

    How to add this in .lua

    Code:
    CLuaBase lua;	lua.SetGlobalPointer("PRJ", this);
    	lua.RegisterFunction("AddLimit", &CProject::AddUpgradeLimit);
    	lua.SetGlobalInt32("NOLIMIT", 0);
    	lua.SetGlobalInt32("GENERAL", 0);
    	lua.SetGlobalInt32("ACCESSORY", 1);
    	lua.SetGlobalInt32("ULTIMATE_WEAPON", 2);
    	lua.SetGlobalInt32("BARUNA_WEAPON", 3);
    	lua.SetGlobalInt32("BARUNA_SUIT", 4);
    	lua.SetGlobalInt32("BARUNA_ARMORETC", 5);
    	lua.SetGlobalInt32("PIERCING_SUIT", 6);
    	lua.SetGlobalInt32("PIERCING_WEAPON", 7);
    	lua.SetGlobalInt32("BARUNA_ACCESSORY",8);
    Code:
    	lua_getglobal(luastate,"PRJ");	CProject* ptr = (CProject*)lua_topointer(luastate, -1); // why not practice avoiding globals?
    	switch (lua_tointeger(luastate, 1))
    	{
    		case 0: // GENERAL
    			ptr->m_mapUpgradeCap_General.insert(make_pair(lua_tointeger(luastate, 2), lua_tointeger(luastate, 3)));
    			break;
    		case 1: // ACCESSORY
    			ptr->m_mapUpgradeCap_Accessory.insert(make_pair(lua_tointeger(luastate, 2), lua_tointeger(luastate, 3)));
    break;




Advertisement