[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Compiling a Pascal DLL for Lua
- From: Romulo <romuloab@...>
- Date: Tue, 1 Mar 2011 09:40:09 -0300
On Tue, Mar 1, 2011 at 09:37, luciano de souza <luchyanus@gmail.com> wrote:
> library test;
> uses
> lua;
>
> function prandom(l: plua_state):integer;
> var
> n: integer;
> begin
> randomize;
> n := random(100);
> lua_tonumber(l, n);
> prandom:=1;
> end;
>
> function lua_opentest(l: plua_state):integer;
> begin
> lua_register(l, 'random', prandom);
> lua_opentest := 1;
> end;
>
> exports
> prandom;
>
> begin
> end.
Both prandom and lua_opentest must be cdecl'ed. Also, you should
export lua_opentest[1] instead of prandom.
--rb
[1] I think you meant luaopen_test, not lua_opentest.