[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Compiling a Pascal DLL for Lua
- From: luciano de souza <luchyanus@...>
- Date: Tue, 1 Mar 2011 10:02:03 -0300
Well, regarding the steps to compile a regular program, with your
hints, this code seemed to be more logical.
Now, I am following rigourously the same steps.
library test;
uses
lua;
function prandom(l: plua_state):integer; cdecl;
var
n: integer;
begin
randomize;
n := random(100);
lua_tonumber(l, n);
prandom := 1;
end;
function luaopen_test(l: plua_state):integer; cdecl;
begin
l := lua_open;
lua_register(l, 'random', prandom);
lua_pcall(l, 0, 0, 0);
lua_close(l);
end;
exports
luaopen_test;
begin
end.
Now, I am not in front of the computer where I have Lua, but I think
is this. Thank you for the help!
2011/3/1, Daurnimator <quae@daurnimator.com>:
> On 1 March 2011 23:37, luciano de souza <luchyanus@gmail.com> wrote:
>> function prandom(l: plua_state):integer;
>> var
>> n: integer;
>> begin
>> randomize;
>> n := random(100);
>> lua_tonumber(l, n);
>> prandom:=1;
>> end;
>>
>
> You probably wanted pushnumber; not tonumber.
>
> Daurn.
>
>
--
Luciano de Souza