lua-users home
lua-l archive

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


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