• Advertisement
Sign in to follow this  

luabind wrapper_class

This topic is 4689 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to bind a simple class with a method that has no parameters. I'm working with the CVS version of luabind and I tested their example in their docs. Here's my code, it's similar to the example in the doc but the method I'm overriding doesn't have any parameters: class Poo { public: Poo() { } ~Poo() { } virtual void Print( ) { cout << "Poo!" << endl; } }; struct poo_wrapper : Poo, luabind::wrap_base { poo_wrapper() : Poo() { } virtual void Print() { call< void >( "Print" ); } static void default_Print( Poo* p ) { return p->Poo::Print( ); } }; module( LuaEnv::GetState( ) ) [ class_< Poo, poo_wrapper >( "Poo" ) .def( constructor<>() ) .def( "Print", &Poo::Print, &poo_wrapper::default_Print ) ]; -- Here's the lua script that runs this class 'Poo2' (Poo) function Poo2:__init() super('Poo2') end function Poo2:f( a ) print('Poo2:print() -> ') Poo.Print(self) end Notice the print method doesn't have any parameters. So when I run this, I get an assertion "Expression: _BLOCK_TYPE_IS_VALID( pHead->nBlockUse )". I have a feeling I'm not invoking the call() function correctly. Any hints? [Edited by - jackiechan on April 24, 2005 7:24:40 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement