getinfo say about it.
Every function on this page is reachable both as
debug.<name> and as a
plain global of the same name, so debug.getupvalues(f) and getupvalues(f)
are the same call.Parameters
function | number
required
The function to relabel, or a stack level.
table
required
A table of replacements. Recognised keys:
source, short_src, name,
linedefined. Anything else is ignored.Behavior
sourcewins overshort_src. Givesourceto set the chunk name exactly. Giveshort_srcinstead and the existing=or@marker is kept on the front, so the chunk keeps its kind.- It edits the prototype, so every closure sharing it reports the new information.
- Only the listed keys are read. Other debug fields are derived from the bytecode and cannot be rewritten this way.
Example
Errors
Related
getinfo: read it back.