Difference between revisions of "Lua:encodeFunction"
Jump to navigation
Jump to search
(→Examples) |
(Tag: Undo) |
||
| Line 17: | Line 17: | ||
== Examples == | == Examples == | ||
<pre> | <pre> | ||
| − | + | local function myCoolFunction(str) print(str) end | |
| − | + | print(encodeFunction(myCoolFunction)) | |
| − | + | </pre> | |
| + | <pre> | ||
| + | local function myCoolFunction(str) print(str) end | ||
| + | local encodedFunc = encodeFunction(myCoolFunction) | ||
| + | local decodedFunc = decodeFunction(encodedFunc) | ||
| + | decodedFunc('I have the power!') | ||
| + | </pre> | ||
| + | |||
| + | {{LuaSeeAlso}} | ||
| + | |||
| + | === Related Functions === | ||
| + | * [[Lua:decodeFunction|decodeFunction]] | ||
Latest revision as of 16:00, 10 February 2021
function encodeFunction(function, protect OPTIONAL) : string
Converts a given function into an encoded string that you can pass to decodeFunction.
Function Parameters[edit]
| Parameter | Type | Description |
|---|---|---|
| function | function | The function to encode |
Examples[edit]
local function myCoolFunction(str) print(str) end print(encodeFunction(myCoolFunction))
local function myCoolFunction(str) print(str) end
local encodedFunc = encodeFunction(myCoolFunction)
local decodedFunc = decodeFunction(encodedFunc)
decodedFunc('I have the power!')