I want to pass parameters in method by reference. class Node : public EventReceiver { public: virtual void setTag ( const std::string& name, const std::string& value ) ... }; And this is luabind code to expose Node to lua: class_<Node, EventReceiver> ( "Node" ) .def ( constructor<> () ) .def ( "setTag", &Node::setTag ) ... I want to set tag for node from lua script: node = scene:find ( "NewGameButton" ) node:setTag ( "scale", value ) I get luabind error: No matching overload found, candidates: void setTag(Node&,std::string const&,std::string const&) But this line works fine node:setTag ( "scale", "str_value" ) How to get setTag working in both cases? ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user |
On 2015-03-31 23:33 +0200, Сергей ВладимировичСергей Владимирович wrote:
> [...] > > I want to set tag for node from lua script: > node = scene:find ( "NewGameButton" ) > node:setTag ( "scale", value ) > > I get luabind error: > No matching overload found, candidates: > void setTag(Node&,std::string const&,std::string const&) > > But this line works fine > node:setTag ( "scale", "str_value" ) > > How to get setTag working in both cases? > It seems that value is not a string. AFAIR luabind does not implicitly convert numbers to strings, so you should try node:setTag ( "scale", tostring( value ) ) where tostring() is a Lua standard library function (http://www.lua.org/manual/5.1/manual.html#pdf-tostring). ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user |
Thanks. Worked. 2015-04-01 0:41 GMT+03:00 Christian N. <[hidden email]>: On 2015-03-31 23:33 +0200, Сергей ВладимировичСергей Владимирович wrote: ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user |
Free forum by Nabble | Edit this page |