lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



<CFF13916-C600-4F48-960C-F003A5F6C091@dnainternet.net>
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 string)
CFF13916-C600-4F48-960C-F003A5F6C091@dnainternet.net>
Hello Luo Hei,
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.
Regards,
Mark



Yahoo! for Good helps you make a difference