8 ms·
The author informs that the stack is "difficult bit to wrap your head around first", then makes a bizarre statement "Once again – pushed values are indexed with
by aDevilInMe 11y ago
The author informs that the stack is "difficult bit to wrap your head around first", then makes a bizarre statement "Once again – pushed values are indexed with negative, function arguments with positive numbers." This is not correct, you can use positive or negative indexes in either case. Positive indexes are absolute and negative are relative to the top of the stack.
- vavrusa 11y agoYes you're right, I just hoped that this may be a useful mnemonic (admittedly maybe a confusing one, but worked for me) for people starting with Lua. A simplification. How the index with negative offset is computed is explained in detail in the linked PIL/"The Stack" then. From my experience, the most common errors for beginners are 1-based indexing and stack manipulation.