[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Setting globals in the C API
- From: Marc Balmer <marc@...>
- Date: Tue, 2 Aug 2016 21:12:21 +0200
> Am 02.08.2016 um 20:37 schrieb Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>:
>
>> I assume that I have to set _ENV for each chunk that possibly runs
>> during template rendering (it can be many, and the idea is to call
>> them repeatedly using different data tables). So this would mean to
>> fixup _ENV for each chunk everytime the render() function is called?
>
> When you convert templates to Lua code, add this line at the top of each script:
> local _ENV = ...
>
> (That's three dots as in varargs.)
> Then you can run each script passing a suitable table as its env at run time.
>
I will try that. It has been proposed to me in private mail as well.
Thanks!