Call arguments

From Final Fantasy XII Wiki
Jump to navigation Jump to search

All arguments for called functions are pushed onto stack in order of appearance in function signature. In other words, top of the stack contains the last argument.

E.g. a c-like call

setpos(posx, posy, posz);

Is represented by

PUSHV [posx]
PUSHV [posy]
PUSHV [posz]
CALLPOPA [setpos]

If a function is called within a context of another script, different instruction is used and additional value (representing script number) is pushed onto the stack. E.g. a c-like call

NPC01.setpos(posx, posy, posz);

Is represented by

PUSHV [posx]
PUSHV [posy]
PUSHV [posz]
PUSHII 2   #where 2 is script number
CALLACTPOPA [setpos]