debug.getinfo

From GMod Wiki

Jump to: navigation, search
Function
Syntax debug.getinfo( Thread thread or Function func , ... )
Where is this used?
Description:
Returns a table of info about the function you provided, you can also provide a number (a level), 1 being the current function, 2 being the caller, 3 being the caller of the caller, etc
You can also specify a second argument, being a mask of the output, for example, if you specify S it will output the source, short_src, what, linedefined and lastlinedefined fields
Returns: Table info
Part of Library: Debug
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Debug.getinfo]Debug.getinfo [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionPrints the file the current function was called from.
Used onNewerShared.png
Code
 
print(debug.getinfo(1, "S").short_src)
 
OutputIn the console
autorun/debug_test.lua

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox