lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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.