Embedding as scripting engine

Jp Calderone exarkun at intarweb.us
Tue Jul 8 13:39:37 EDT 2003


On Tue, Jul 08, 2003 at 03:50:55AM -0700, ?lfur Kristj?nsson wrote:
> Python... a great language, no doubt. And the abillity to be able to
> extend it with C/C++ code, fantastic. But has anybody been able to
> successfully embed Python in their application to use it as a
> scripting language of sorts?

  Surprisingly, yes.

> 
> I am in the process of writing a game and from the documentation and
> word of mouth gathered that Python would be just the thing for the
> scripting part. And sure enough it is easy enough to run Python code
> from C/C++. However, in order to be make it do something actually
> useful for my game it would be handy to be able to pass in anything
> besides the basic data types (strings, numerics) such as either an
> instance of or a pointer to a gameobject. What I want to be able to do
> is something like this:
> 
> GameObject go;
> 
> Py_Initialize()
> ...
> PyObject* po = GameObject2PyObject(go);
> ...
> result = PyObject_CallObject(func, "O", po );
> ...
> go = PyObject2GameObject(result);
> 
> Theres alot of documentation and discussion out there that suggests
> that this should be possible but noone seems to tell you how it's
> actually done. Am I just missing something blatantly obvious?

  Your question is to vague and short on details to be answered usefully.

  What specific problems have you run into?

  Jp

-- 
No, `Eureka' is Greek for `This bath is too hot.'
                -- Dr. Who





More information about the Python-list mailing list