Re: setfenv/getfenv
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: setfenv/getfenv
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: 2010年1月12日 16:22:32 -0200
> 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.