I added a function terralib.bindtoluaapi that can bind any generated terra
function back into  the current interpreter state as if you called
lua_pushcclosure on it. tests/luaapi.t has an example using it.

Right now it does no error checking of the function being bound. If this
ends up being useful, I may add a higher level API on top that does some
checking.

-- Zach

On Fri, Oct 16, 2015 at 11:44 AM, Zach DeVito <[email protected]> wrote:

> There isn't right now but I am open to adding one since I think this is a
> good use case.  I think it is a relatively simple change, but I have to
> double-check that there aren't issues with lifetimes of certain objects
> like Terra functions. -- Zach
>
> On Fri, Oct 16, 2015 at 11:38 AM, Leonard Ritter <[email protected]> wrote:
>
>> Hi,
>>
>> I'm currently working on a HTML-like engine. My idea was to use Lua
>> tables for the HTML Markup-tree (as the data model is very similar), but
>> then to iterate the tables calling Lua's C functions from Terra for
>> performance reasons.
>>
>> For this to work, without having to open a second interpreter context, I
>> would need access to the active interpreter state. Is there an official way
>> to do this?
>>
>> Cheers,
>> Leonard
>>
>> _______________________________________________
>> terralang mailing list
>> [email protected]
>> https://mailman.stanford.edu/mailman/listinfo/terralang
>>
>>
>
_______________________________________________
terralang mailing list
[email protected]
https://mailman.stanford.edu/mailman/listinfo/terralang

Reply via email to