Untitled

Published September 26, 2006
Advertisement
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
Previous Entry Untitled
Next Entry Untitled
0 likes 1 comments

Comments

Pipo DeClown
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.
September 27, 2006 09:21 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Untitled

5590 views

Untitled

1081 views

Untitled

1225 views

Untitled

1136 views

Untitled

1183 views

Untitled

1467 views

Untitled

1135 views

Untitled

1036 views

Untitled

1040 views

Untitled

1220 views
Advertisement