loadstring returns a function that you need to call.Be sure to also check the manual for possible error returns.
--
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lua-l+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lua-l/dc0dd8bc-0d2f-4a85-b79e-d52514277bfd%40app.fastmail.com.
load or loadstring is not the inverse of string.dump.
string.dump (function [, strip])
Returns a string containing a binary representation (a binary chunk) of the given function, so that a later
loadon this string returns a copy of the function (but with new upvalues).
string.dump returns the bytecode of the function.
load (chunk [, chunkname [, mode [, env]]])
Loads a chunk.
...
If there are no syntactic errors,
loadreturns the compiled chunk as a function; otherwise, it returns fail plus the error message.
load (loadstring in older Lua versions) returns a function (not the source code of the function). You can call this function but not get its source code.
Try `textBack()` instead of `print(textBack)` (the name "textBack" may be misleading in this case):
chunk = assert(loadstring(dmp)) chunk()
On the other side, if you want to get the original text back, dump/load may not be the right functions. Do you actually need to compile/decompile Lua sources? Or just encrypt them for whatever purpose?
To view this discussion on the web visit https://groups.google.com/d/msgid/lua-l/CA%2BymkRioG0Y9L7vHSsgGhgSj9eBbg%2BMnWSZxSuDS%2BK9h62hXOQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lua-l/4c5aec79-37fb-4bae-ae9b-995428fda2f8%40cdelord.fr.