Don't click here unless you want to be banned.

LSL Wiki : Stack

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are


Stack memory is a LIFO-based memory structure.

Stack is used when passing variables into functions. The data is "pushed" onto the stack, then "pulled" off the stack by a function. Each script has it's own stack space which counts towards a script's memory allocation. (This is why it is common to see a script crash when passing complete lists between functions, as it effectively doubles its size temporarily--while passing the information to functions.)

When calling a new function, the stack operates as follows:

Push: Variable A onto stack (make a copy)
Push: Variable B onto stack
Push: Variable C onto stack
Store location
Adjust memory offset
Jump to the function
<do function stuff>
Push: Result
Jump back to stored location
Re-adjust memory offset
Pull or Peak: Result as needed.

The above example is basicly how LSL does it, but not exactly. --BW

memory | FIFO
There is one comment on this page. [Display comments/form]