lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On 08/10/15 01:55 PM, Pat Brown wrote:
On Tuesday, October 06, 2015 11:14:47 AM Soni L. wrote:
sourcecode_part = "f = %s f(print, 'hello world!')"
bytecode_part = string.dump(function(pf, v) pf(v) end)
combined_parts = string.format(sourcecode_part, bytecode_part)
loaded_function = load(combined_parts)
loaded_function() --> prints "hello world!"

(Note: Code shown here doesn't (yet) work, it's just an example)
Doesn't work because you're not using %q. Change sourcecode_part to
"f = load%q f(print, 'hello world!')".

That's not the point.

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.