[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Compiling a DLL to be used in Lua
- From: Tom N Harris <telliamed@...>
- Date: Sat, 01 May 2010 19:50:08 +0000
On 5/1/2010 5:11 PM, Luciano de Souza wrote:
Hi listers,
I am trying to write a DLL with code callable for Lua. I can understand
this example, but it's not enough to do what I want.
program h9k;
You need to export the initialization function. Assuming that you want
to do require("h9k") then the function you export is luaopen_h9k with
the same argument and return as any other Lua CFunction.
In the library unit put an exports block. That would look something like:
library h9k;
uses {...};
exports
luaopen_h9k;
begin
{ Nothing to do here. }
end.
The luaopen_h9k function creates a table with the module contents and
returns it on the stack.
Disclaimer: My Delphi-fu isn't all that great and I've never actually
created a Lua module with it before.
--
- tom
telliamed@whoopdedo.org