1 // Copyright Daniel Wallin 2008. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #include <luabind/luabind.hpp>
20 struct default_converter
<X
>
21 : native_converter_base
<X
>
23 int compute_score(lua_State
* L
, int index
)
25 return cv
.compute_score(L
, index
);
28 X
from(lua_State
* L
, int index
)
30 return X(lua_tonumber(L
, index
));
33 void to(lua_State
* L
, X
const& x
)
35 lua_pushnumber(L
, x
.value
);
38 default_converter
<int> cv
;
41 } // namespace luabind
53 void test_main(lua_State
* L
)
55 using namespace luabind
;
63 "assert(take(1) == 1)\n"
64 "assert(take(2) == 2)\n"
68 "assert(get(1) == 1)\n"
69 "assert(get(2) == 2)\n"