Luffy Posted January 1, 2018 at 04:25 AM Share Posted January 1, 2018 at 04:25 AM (edited) Pessoal, alguém saberia me dizer o que tem de errado nesta função abaixo? Acredito que seja uma função original da source, mas parece haver um erro nela. Sempre que ela é chamada aparece "invalid argument" no syserr do canal. Ela ta na quest que serve pra criar, sair e desfazer guild. Spoiler int guild_is_war (lua_State* L) { if (!lua_isnumber (L, 1)) { sys_err ("invalid argument"); return 0; } LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (ch->GetGuild() && ch->GetGuild()->UnderWar ((DWORD) lua_tonumber (L, 1))) { lua_pushboolean (L, true); } else { lua_pushboolean (L, false); } return 1; } Edited January 1, 2018 at 04:30 AM by Luffy Link to comment Share on other sites More sharing options...
GODSPEED Posted May 5, 2018 at 07:32 PM Share Posted May 5, 2018 at 07:32 PM Parece a primeira vista que o argumento L Passado não é passado como inteiro entre 0 e 1 Link to comment Share on other sites More sharing options...
oserra Posted May 5, 2018 at 07:54 PM Share Posted May 5, 2018 at 07:54 PM guild_is_war só pode ser um booleano(true/false) daí dar-te esse erro, a quest está-lhe a dar o valor 1(não é suposto). Link to comment Share on other sites More sharing options...
GODSPEED Posted May 5, 2018 at 07:56 PM Share Posted May 5, 2018 at 07:56 PM (edited) 2 minutos atrás, oserra disse: guild_is_war só pode ser um booleano(true/false) daí dar-te esse erro, a quest está-lhe a dar o valor 1(não é suposto). a Função trabalha com int ela só se torna bool aqui : { lua_pushboolean (L, true); } else { lua_pushboolean (L, false); } o retornar 0 ou 1 da função é para reportar um erro nesse caso o Invalid argument Edited May 5, 2018 at 07:57 PM by GODSPEED Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now