namespace luabind { template <> struct default_converter: native_converter_base { static int compute_score(lua_State* L, int index) { return lua_type(L, index) == LUA_TSTRING ? 0 : -1; } QString from(lua_State* L, int index) { return QString(lua_tostring(L, index)); } void to(lua_State* L, QString const& x) { lua_pushstring(L, x.toAscii()); } }; template <> struct default_converter : default_converter {}; }
Saturday, June 5, 2010
Luabind converter for QString
Luabind is a very convenient tool for binding C++ code to Lua. If you want to use Lua inside your Qt project then support for QString type is a must. By adding a little C++ template you can teach Luabind how to convert between QString and Lua string types. Just copy and paste the following code.
Subscribe to:
Post Comments (Atom)
This is wonderful! But I think the first template should read:
ReplyDeletestruct default_converter
: native_converter_base
and the second:
struct default_converter
: default_converter
...ugh. I mean, of course:
ReplyDeletestruct default_converter<QString>
: native_converter_base<QString>
and
struct default_converter<QString const&>
: default_converter<QString>
So it was probably the html filter in the first place.
Thanks hakeliha. Do you do any interesting stuff with lua? If so then drop me an email.
ReplyDeleteCasino 2021 - Mapyro
ReplyDeleteCasino 영주 출장마사지 2021. Find your 청주 출장샵 ideal location in Greater Boston. Explore our 대구광역 출장안마 selection of slot 춘천 출장안마 machines, table games, blackjack, roulette 광주 출장마사지 and more.Borgata Hotel · Atlantic City Casino & Spa
Playing or success on this game doesn't suggest future success at ‘real money’ playing. Caesars Slots doesn't require fee to access and play, nevertheless it also permits 토토사이트 you to purchase digital objects with actual cash inside the sport. You may require an web connection to play Caesars Slots and access its social options. You can even find more details about the functionality, compatibility and interoperability of Caesars Slots in the above description.
ReplyDelete