Hello, can someone explain what mean lua_pop?
there i have example code:
i trying learn and make function to getitemcount but no have idea how lua_pop works
how i can achieve it?
getitemcount(item_id) > 0){
how to check if >0 == item count?
}
there i have example code:
C++:
int32_t NpcScript::luaGetItemCount(lua_State* L){
int item_count= (int)lua_tonumber(L, -1);
uint32_t item_id = (uint32_t)lua_tonumber(L, -2);
int32_t id = (int32_t)lua_tonumber(L, -3);
lua_pop(L, 3);
Npc* mynpc = getNpc(L);
Creature* creature = mynpc->game->getCreatureByID(id);
Player* player = creature? dynamic_cast<Player*>(creature) : NULL;
if (player && player->getItem(item_id, item_count)){
return 1;
}else{
return 0;
}
}
i trying learn and make function to getitemcount but no have idea how lua_pop works
how i can achieve it?
getitemcount(item_id) > 0){
how to check if >0 == item count?
}
C++:
if (player && player->getItem(item_id, count)){
}
look like in lua:
if getitemcount(2160, 10)
but how i can acheive it?
if getitemcount(2160) > 10
Last edited: