[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: c args to lus?
- From: "Kevin Baca" <lualist@...>
- Date: Thu, 12 Aug 2004 10:03:17 -0700
lua_tonumber() is a C function.
The lua equivalent is tonumber().
>From lua your function call should look like:
local left, top, right, bottom = deskGetDesktopSize()
deskMainWndMove(200,200,500,500)
-Kevin
> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br
> [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of
> mark greenlancer
> Sent: Thursday, August 12, 2004 12:05 AM
> To: Lua list
> Subject: Re: c args to lus?
>
>
> Kevin Baca wrote:
>
> > <>No need to reset the stack.
> >
> > While it's always good to restrict stack growth, lua does
> clean up the
> > stack after function calls.
> >
> > The return value 4 tells lua to take the 4 top-most stack
> values as the
> > return values of the function, no matter how large the
> stack has grown.
>
> okay
>
> > <>Not sure about the context surrounding lua_tonumber(this, 1).
> >
> > What is "this"? Where is the call made?
>
> I also tried only lua_tonumber(1)
>
> The complete error msg is
> "s_mainwnd.lua:5: attempt to call global `lua_tonumber' (a nil value)"
>
> The lua source:
>
> -- deskGetDesktopSize(a,b,c,d)
> deskGetDesktopSize()
> lua_tonumber(1)
> deskMainWndMove(200,200,500,500)
>
> The c source
>
> int deskLuaGetDesktopSize(lua_State *l)
> {
> RECT rc;
>
> GetWindowRect(GetDesktopWindow(), &rc);
>
> //lua_settop(l, 0);
> lua_pushnumber(l, rc.left);
> lua_pushnumber(l, rc.top);
> lua_pushnumber(l, rc.right);
> lua_pushnumber(l, rc.bottom);
>
> return 4;
> }
>
> mark
>