[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: problem passing std::strings, lua and swig
- From: Mark Gossage <mark@...>
- Date: Mon, 14 Apr 2008 10:34:49 +0100 (BST)
<CFF13916-C600-4F48-960C-F003A5F6C091@dnainternet.net>Hello Luo Hei,
Im changing my code to use swig, but I have found a problem. A function
that takes one std::string as parameter produces an error when called
from Lua: says that "string"
was expected but got "string". Previously I
was using Ogre::String but that produced an error about missing
arguments, said that the function required 2 parameter, not 1. Also, if
I use std::string in the header and string in the .cpp I got a similar
error (expected std.. got
Its not a problem. For a function like:
void func(std::string s)
You can get an error:
expected 'std::string' got a 'string'
What you need to do is to add in a %include <std_string.i> to enable
support for std::string (its not enabled by default). This will now automatically map std::string<->Lua-strings
That should fix matters.
Yahoo! for Good helps you make a difference