lua-users home
lua-l archive

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


This is the create_viewport() function.

int api_create_viewport(lua_State *client_state)
{
 // userdata viewport_pointer = create_viewport()

 lua_pushuserdata(client_state, new Viewport);

 return 1;
}

Thanks, Philip Bock

----- Original Message -----
From: "Edgar Toernig" <froese@gmx.de>
To: "Multiple recipients of list" <lua-l@tecgraf.puc-rio.br>
Sent: Monday, November 19, 2001 9:28 PM
Subject: Re: Userdata and methods


> Philip Bock wrote:
> >
> >   if ((lua_gettop(client_state) >= 5) && lua_isuserdata(client_state,
1))
> >  {
> >   Viewport *this_viewport = (Viewport *) lua_touserdata(client_state,
1);
> >
> > The program gives a segmentation fault at the first attempt to access
> > this_viewport after it is initialized. Anyone have any ideas? I'm new to
> > Lua, so it's probably just a stupid mistake. Thanks, Philip Bock.
>
> Hmm... looks sane.  Are you sure, your lua_pushusertag is correct?  Or
that
> you get the right userdata object (you don't check the tag)?
>
> Ciao, ET.
>
>