1 // Copyright Daniel Wallin 2009. 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>
7 #include <luabind/class_info.hpp>
18 void test_main(lua_State
* L
)
20 using namespace luabind
;
28 .def_readonly("x", &X::x
)
29 .def_readonly("y", &X::y
)
34 "info = class_info(x)\n"
35 "assert(info.name == 'X')\n"
36 "assert(info.methods['f'] == x.f)\n"
37 "assert(info.methods['__init'] == x.__init)\n"
38 "assert(info.attributes[1] == 'y')\n"
39 "assert(info.attributes[2] == 'x')\n"
40 "info = class_info(2)\n"
41 "assert(info.name == 'number')\n"
42 "assert(#info.methods == 0)\n"
43 "assert(#info.attributes == 0)\n"
44 "names = class_names()\n"
45 "assert(type(names) == 'table')\n"
46 "assert(#names == 2)\n"
47 "assert(names[1] == 'X' or names[2] == 'X')\n"
48 "assert(names[1] == 'class_info_data' or names[2] == 'class_info_data')\n"