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

Introspective information

Lua provides the debug.getinfo function to inspect the currently running code. This function takes one of two arguments, either a function or an integer. When the argument is an integer, getinfo will look the specified number of steps up the callstack. For example, let's assume you have the following code:

function one()   print ("one")endfunction two()  one()  print("two")endfunction three()  two()  print("three")  debug.getinfo(1)end

Providing an argument of 1 will inspect the function calling debug.getinfo, or function three. Providing 2 will go one more function up the callstack, inspecting function two. Or, providing 3 will look even further up the callstack and inspect function one.

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