Some quetsions have been solved for me, but my message system does not
work yet..Anyone knows how to call a Ruby Class method from C++ ? Here
is my code
RUBY:
class SpaceShip < Rs::Mesh
def OnFire()
Rs:Log("Just a dummy log message to show its working")
end
end
s = SpaceShip.new()
C++
String callString = "On";
callString += m_msg;
callString += "()";
// Generated for the method
ID callId = rb_intern( callString );
// Now create the parameter array for the call...
Array<VALUE> args;
LogInfo(("Calling ruby object: %s::%s",rb_class2name( val ),(const
char *)callString ) );
if ( rb_respond_to( val,callId ) )
{
// And make the script call
rb_funcall2( val,callId,args.Size(),args.Begin() );
}
m_msg contains: "Fire"
val ist the VALUE of the s variable in Ruby ..
However rb_respond_to always returns false ? Why ? No second ruby
interpreter is running ....
And the logmessage reads: Calling ruby object: SpaceShip::OnFire()
Anyone is able to help me to get that working ?