Lua:encodeFunction
Jump to navigation
Jump to search
Converts a given Lua function into an encoded string.
The encoded string can later be passed to decodeFunction to recreate the function.
Function Parameters
| Parameter | Type | Description |
|---|---|---|
| function | Function | The Lua function that should be encoded. |
Returns
String — The encoded function string.
Examples
local encoded = encodeFunction(function()
print("Hello from an encoded function")
end)
print(encoded)
local encoded = encodeFunction(function(value) return value * 2 end) local decoded = decodeFunction(encoded) print(decoded(21))
local function testFunction()
showMessage("This function was encoded and decoded")
end
local encoded = encodeFunction(testFunction)
local decoded = decodeFunction(encoded)
decoded()