[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Best practices for lua_Reader?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sat, 9 Jun 2012 20:46:45 -0300
> Basically what I'm stumbling over is the fact that the callback can be
> called x many times, so I need to keep state. I presume that's what the
> second parameter (void* data) is good for?
> My callback offers the complete buffer in the first read, simply because
> it's already in memory and I'm merely telling Lua where to find it.
So why not just use luaL_loadbuffer?
> PS: if you have any sources for more information or even sample
> implementation you can point to, I'd appreciate if you could include those.
Read lauxlib.c and my own ae:
http://www.lua.org/source/5.2/lauxlib.c.html (at Load functions)