July 2018
Beginner
202 pages
5h 42m
English
Lua references elements in the stack using indices. The bottom element of the stack is index 1; the indices grow towards the top of the stack where the last element was added. Lua can also index the stack in reverse. An index of -1 refers to the top of the stack, -2 to the element right below the top, and so on:

Using indices, you can check the type of any element on the stack. The functions listed here can be used to query the type of element on the stack. They all return true (1) or false (0). Each function takes a Lua state for its first argument and a stack index for its second: