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

Meta tables

You can both test whether a table has a meta table and retrieve the said meta table with the int lua_getmetatable (lua_State*, int) function. The first argument to this function is the Lua state it affects, and the second argument is the index of a table on the stack. If the table at the specified index has no meta table, the lua_getmetatable function returns 0 and does not push anything onto the stack. If the table at the specified index does have a meta table, the lua_getmetatable function will return 1 and push the meta table onto the stack.

You can assign a meta table to an existing table with the int lua_setmetatable (lua_State*, int) function. This function takes the Lua state it affects as its first argument, and the index ...

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