|
Tony Finch wrote:
local t = {} local s = "function f() a = 3 print(a) end" local chunk = assert(loadstring("in ... do "..s.." end")) chunk(t)
Yes, that's what Luiz suggested. But it's not exactly efficient (think of embedded systems) unless a wrapping loading function is used on the C side, as he said. Both techniques are not exactly elegant, especially in a clean language like Lua.
Besides, it could be convenient to be able to execute a chunk in different environments without reloading it.
(I'm not complaining, I'm just trying to fully understand the motivations) Enrico