[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Correct way to write C/Lua mixed module
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 3 Oct 2012 08:16:04 +0200
On Wed, Oct 3, 2012 at 4:32 AM, Andre Leiradella <andre@leiradella.com> wrote:
> That's what I was doing, I just wanted to know if there was a better (as in
> less ugly) way of doing it.
Sometimes it's desirable to keep everything in one module, and it _is_
easier to extend a library in Lua.
For winapi, I used the embed-Lua approach to winapi.dll, except the
ugliness is covered over by a preprocessor using LuaMacro.
https://github.com/stevedonovan/winapi/blob/master/winapi.l.c#L1981
This can work with C as well, and knows about #line directives, so
I've never had a problem tracking down a compile error.
The file lc.lua defines the particular LuaMacro filter used here.
steve d.