Skip to Content
Lua Quick Start Guide
book

Lua Quick Start Guide

by Gabor Szauer
July 2018
Beginner
202 pages
5h 42m
English
Packt Publishing
Content preview from Lua Quick Start Guide

Querying the stack

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:

  • int lua_isnumber(lua_State*, int): Checks ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Lua Programming

Beginning Lua Programming

Kurt Jung, Aaron Brown
Vim Masterclass

Vim Masterclass

Jason Cannon

Publisher Resources

ISBN: 9781789343229Supplemental Content