Skip to content

Debug

Get Constants

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

Retrieve the constants in function fi or at level fi.

Get Constant

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

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

Set Constant

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

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


Get Upvalues

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

Retrieve the upvalues in function fi or at level fi.

Get Upvalue

<T> debug.getupvalue(<function, number> fi, <number> index)

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

Set Upvalue

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

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


Get Protos

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

Returns a table containing the protos (local functions) of function f.

Get Proto

<function> debug.getproto(<function, number> f, <int> index)

Gets the proto (local function) at index index of function f.

Set Proto

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

replaces proto (local function) at index with function replacement at level or function fi.


Get Stack

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

Gets the method stack at level or function fi.

Set Stack

<void> debug.setstack(<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

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

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

Set Upvalue Name

<void> debug.setupvaluename(<table> Name)

Sets the upvalue name to Name.


Error

debug.*locals are removed!

Get Locals

<table> debug.getlocals(<number> lvl)  

Returns a table containing the upvalues at level lvl.

Get Local

<T> debug.getlocal(<number> lvl, <string> localname)  

Returns the local with name localname in level lvl.

Set Local

<void> debug.setlocal(<number> lvl, <string> localname, <table> value)  

Set local localname to value value at level lvl.