Debug Library

Get Constants

<table> debug.getconstants(union<function, number> fi)  

Retrieve the constants in function fi or at level fi.

Get Constant

<variant> debug.getconstant(union<function, number> fi, <number> idx)  

Returns the constant at index idx in function fi or level fi.

Set Constant

<void> debug.setconstant(union<function, number> fi, union<string, int> idx, union<number, bool, nil, string> value)  

Set constant idx to tuple value at level or function fi.


Get Upvalues

<table> debug.getupvalues(union<function, number> fi)  

Retrieve the upvalues in function fi or at level fi.

Get Upvalue

<variant> debug.getupvalue(union<function, number> fi, <number> idx)

Returns the upvalue with name idx in function or level fi.

Set Upvalue

<void> debug.setupvalue(<function, number> fi, <number> idx, <table> value)  

Set upvalue idx to value value at level or function fi.


Get Protos

<table> debug.getprotos(<function> f)

Returns a table containing the inner functions of function f. Note these functions will not have upvalues, use debug.getproto with activated true to get a list of instances.

Get Proto

union<function, table<function>> debug.getproto(<function, number> f, <int> index, <bool?> activated)

Gets the inner function of f at index.

Note if activated is true, instead it will return a table of functions. These are the instances of that function that exist within the GC.

Set Proto

<void> debug.setproto(<function> fi, <number> index, <function> replacement)

Replaces fi at index with function replacement at level or function fi.


Get Stack

<table> debug.getstack(union<function, number> fi)

Gets the method stack at level or function fi.

Set Stack

<void> debug.setstack(union<function, number> fi, <number> indice, <table> value)

Set the stack indice at indice to value value at level or function fi.


Set Metatable

<table> debug.setmetatable(<table> o, <table> mt)  

Set the metatable of o to mt.

Get Registry

<table> debug.getregistry(<void>)  

Returns the Lua registry.

Get Info

<table> debug.getinfo(union<function, number> fi, <string> w = "flnSu")  

Returns a table of info pertaining to the lua function fi.