Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    570
  • comments
    2427
  • views
    217369

Untitled

Sign in to follow this  
Mushu

269 views

lolol okay, almost done with the basic data-sharing. Here's the usage I've worked out for it:

You take your happy user-defined POD struct. Well, it doesn't have to be a POD, since Python takes the offsets into the struct just fine. I guess it isn't going to handle inheritence at this point, but whatever. SO YOU HAVE A POD CLASS ANYWAY:
struct Rah {
int arg1;
char* arg2;
};

You then call some code to get a registration stub, which you use to set up exactly which members you'd like to expose to python, what you'd like them to be referenced as, blah blah then you finalize the stub (which deletes it!!!) -
	StructRegStub* stub = exposeDataType( "Rah" );
stub->exposeMember( "arg1", &Rah::arg1 );
stub->exposeMember( "arg2", &Rah::arg2 );
stub->finalize();

And then boom your class is now recognized in Python and you can send them back and forth and stuff. Except you can't yet because I haven't coded that. Well, I might of (actually, I think I did). But I haven't tested it yet.

And besides there's still a couple bugs in the first part (lol, shit breaking: offsets, members overwriting each other, etc.) so I have to fix that first :3
Sign in to follow this  


1 Comment


Recommended Comments

Nice! I love the way this system works as it eliminates the trouble of the engine <-> script communcation that other *lua* scripting languages fuck you up with.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!