[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: figuring out 4.1
- From: "Tristan Rybak" <rybak@...>
- Date: Sat, 24 Nov 2001 19:42:46 +0100
After pushing values You should return number of them so do:
static int testfunction ( lua_State * L )
{
lua_pushnumber( L, 99 );
lua_pushstring( L, "hello" );
return 2;
}
Tristan
----- Original Message -----
From: "Jim Mathies" <jamesmathies@home.com>
To: "Multiple recipients of list" <lua-l@tecgraf.puc-rio.br>
Sent: Saturday, November 24, 2001 7:37 PM
Subject: figuring out 4.1
> Hey all,
>
> Can someone point out what i'm missing that is obviously wrong here? I'm
> using 4.1 -
>
> static int testfunction ( lua_State * L )
> {
> lua_pushnumber( L, 99 );
> lua_pushstring( L, "hello" );
> return 0;
> }
>
> lua_pushcfunction( L, testfunction );
> lua_setglobal( L, "testfunction" );
> lua_dostring( L, "val1,val2 = testfunction() print( tostring(val1) ..
',' .. tostring(val2) )" );
> printf("stack size: %d\n",lua_gettop( L ));
>
>
> output:
>
> nil,nil
> stack size: 0
>
>
>