debug.setconstant
Replaces a constant in a function's constant table.
function debug.setconstant(funcfuncfunction | numberA Luau function or stack level.: function | number, indexindexnumberConstant index to replace.: number, valuevalueanyNew value (must match type of existing constant).: any): ()Usage
Patch a string constant
local function foo()
print("Goodbye, world!")
end
debug.setconstant(foo, 3, "Hello, world!")
foo() --> Hello, world!