Hi John,

After hours of searching around what i possibly do wrong i give up.
It is the next peace of code in canlua.cpp

It call the hit function in the script incircles.lua, and i tested that it does ( after loading it from the menu in the sample of course ).
But somehow the boolean return result is totally wrong.

I went as far as calling a lua function which adds two numbers, and return that number, and it has the same behaviour. Meaning that at least the first time the result is at number 9 on the returned stack?? It even tells there are 9 result, while i think there is only one. With lst.GetBooleanType(0) the application just stops, there is an error generated in the check for the boolean type, but where that error end up is not clear to me.

Do you have any idea what i am doing wrong?

It would be nice if the sample actually worked before the first release :-(

Thanks for some help if you can find the time.

Thanks also for the nice changes, i hope to once understand them all :-)

Klaas

bool wxlCanObjScript::DoIsHit( double x, double y, double absx, double absy )
{
   double xh,yh;
   xh = x - absx;
   yh = y - absy;

// run all statements in the script which should be returning a hit on the object or not

   wxLuaState lst = *(m_canvas->GetLuastate());
   lua_State* L = lst.GetLuaState();
   lua_getglobal( L, wx2lua(m_objectname + wxT("Hit")) );
lst.lua_PushNumber( xh );
   lst.lua_PushNumber( yh );

   if ( lst.lua_PCall( 2, 1, 0 ) != 0 )
       lst.SendErrorEvent( wxT("wrong hit function") );

   int argCount = lua_gettop(L);
   bool hit = lst.GetBooleanType(9);

   //wxLogDebug( "hit %d", hit );

   if (hit)
       return true;
   return false;
}



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Wxlua-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to