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

Stack size

You can get the index of the top element of the Lua stack with the int lua_gettop(lua_State*) function. The value this function returns will be the index of the top element on the Lua stack.

You can set the top element (size) of the stack with lua_settop(lua_State*, int). This function returns nothing. The second argument is the element that should be the index of the new top element on the stack. This function effectively resizes the stack.

If the requested stack size with lua_settop is smaller than the previous size, all elements above the new top are simply discarded. If the requested stack size is greater than the previous one, all new elements will be filled with nil.

There is a lua_pop(lua_State*, int) macro defined in ...
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