Difference between revisions of "Lua:decodeFunction"
								
								Jump to navigation
				Jump to search
				
				
		
 					
								
							
		 (→Examples)  | 
				(Tag: Undo)  | 
				||
| Line 15: | Line 15: | ||
|}  | |}  | ||
| − | + | == Examples ==  | |
| − | + | <pre><nowiki>  | |
| − | decodeFunction(  | + | local myCoolFunction = decodeFunction([[c-oWpDNPJ!ketlRCB=/U!NS2(5ypT38s!d+42)bq1T)V$DK]cOh6W(:.:sVD24sPxSl9{RGV?9p8L$BW3{Oh^]])  | 
| + | myCoolFunction('I have the power!')  | ||
| + | </nowiki></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:encodeFunction|encodeFunction]]  | |
| − | |||
Latest revision as of 16:01, 10 February 2021
function decodeFunction(encodedString) : function
Converts a given string converted by encodeFunction back into function.
Function Parameters[edit]
| Parameter | Type | Description | 
|---|---|---|
| encodedString | string | The string to decode into a function | 
Examples[edit]
local myCoolFunction = decodeFunction([[c-oWpDNPJ!ketlRCB=/U!NS2(5ypT38s!d+42)bq1T)V$DK]cOh6W(:.:sVD24sPxSl9{RGV?9p8L$BW3{Oh^]])
myCoolFunction('I have the power!')
local function myCoolFunction(str) print(str) end
local encodedFunc = encodeFunction(myCoolFunction)
local decodedFunc = decodeFunction(encodedFunc)
decodedFunc('I have the power!')