debug.getconstant
Returns the constant at a given index inside a function.
Signature
debug.getconstant(fn: function | number, index: number): anyParameters
fnfunction | numberThe function, or a stack level.
indexnumber1-based constant index.
Returns
any
Example
local function login()
return "token-123"
end
print(debug.getconstant(login, 1)) --> token-123