• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Source modification New lua function.

desalib

New Member
Joined
Jul 4, 2010
Messages
30
Reaction score
0
Hello !

I would like to know how does pop works.
For single arg function it's not a problem.
But for multi args how does it works?

Code:
int32_t LuaInterface::luaDoPlayerSetRate(lua_State* L)
{
	//doPlayerSetRate(cid, type, value)
	double value = popFloatNumber(L);
	uint32_t type = popNumber(L);

In this exemple it seem that the first pop get the last params and the next get the other.
Does it really work this way or it's more complicated than this?
 
If you imagine the arguments like this: Arg1 | Arg2 | Arg3 | Arg4
pop will always return the last argument and return it.

If you have optional arguments you would need gettop to check the amount of arguments which are passed.
 
If I get it right with your exemple : arg1 | arg2 | arg3 | arg4
value = popFloatNumber(L); //will return arg4
value = popFloatNumber(L); //will return arg3
value = popFloatNumber(L); //will return arg2
value = popFloatNumber(L); //will return arg1

Thats right ? : (I mean without optional args)
 

Similar threads

Replies
2
Views
594
Back
Top