lua-users home
lua-l archive

Re: setfenv/getfenv

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


> 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.
I suggested the existing "load" function, which accepts a reader function
that can send the source in pieces and so avoid concatenation.

AltStyle によって変換されたページ (->オリジナル) /