[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Correct way to write C/Lua mixed module
- From: Coda Highland <chighland@...>
- Date: Tue, 2 Oct 2012 18:55:10 -0700
On Tue, Oct 2, 2012 at 6:51 PM, Andre Leiradella <andre@leiradella.com> wrote:
> On 02/10/2012 19:28, Duncan Cross wrote:
>>
>> On Tue, Oct 2, 2012 at 9:12 PM, <andre@leiradella.com> wrote:
>>>
>>> Let me see if I got it right...
>>>
>>> You're suggesting I separate the module in two different modules, one
>>> with the low level C functions, and another one with the high level, Lua
>>> interface which requires and uses the first one. Is that right?
>>>
>>> Seems like a good way to go.
>>>
>>> Thanks,
>>>
>>> Andre
>>
>> A good example to look at is LuaSocket [1], where 'socket' is a Lua
>> module that builds on the undocumented "internal" C module,
>> 'socket.core'.
>>
>> [1] http://w3.impa.br/~diego/software/luasocket/
>>
>> -Duncan
>>
>>
>>
> Yes, that's probably the way I'll go. I'd rather keep everything in one
> file, but that's just personal preference.
>
> Thanks,
>
> Andre
>
If that's what you REALLY insist on, you could always luaL_dostring()
from within the C module. It's not pretty, but it does have the same
effect.
/s/ Adam