[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Binary Modules for Lua [was Re: External modules]
- From: Ignacio Castaño <castanyo@...>
- Date: Fri, 22 Nov 2002 02:23:52 +0100 (CET)
Martin Spernau wrote:
> Main goal was to write a 'tutorial' like minimal extension that is
> completely seft-sufficent, only requiring one C source file.
Hey! I was doing exactly the same thing, but using the luapack library. The
only addition to turn it into a lua module are just 6 lines of code.
Some comments about the code:
1. I think you can remove the "extern int tolua_SDL_open(lua_State *L);" :-)
2. On win32 you can also export the functions by adding them to a .def file,
instead of using __declspec(dllexport). I think it'll look much cleaner.
In fact, if you have an existing lua extension, turning it into a lua
'module' is something as simple as adding the following:
int lua_import(lua_State* L) {
return your_module_init_function(L);
}
const char* lua_version(void) {
return LUA_VERSION;
}
Ignacio Castaño
castanyo@yahoo.es
_______________________________________________________________
Yahoo! Messenger
Nueva versión: Webcam, voz, y mucho más ¡Gratis!
Descárgalo ya desde http://messenger.yahoo.es