*** empty log message ***
[luabind.git] / test / test_const.cpp
blob7bc7a080c40056d9693393068582fa87927ec0fd
1 #include "test.hpp"
2 #include <luabind/luabind.hpp>
4 namespace {
6 struct A
8 const A* f() { return this; }
10 int g1() const { return 1; }
11 int g2() { return 2; }
14 } // anonymous namespace
16 void test_const()
18 lua_state L;
20 using namespace luabind;
22 module(L)
24 class_<A>("A")
25 .def(constructor<>())
26 .def("f", &A::f)
27 .def("g", &A::g1)
28 .def("g", &A::g2)
31 DOSTRING(L, "a = A()");
32 DOSTRING(L, "assert(a:g() == 2)");
34 DOSTRING(L, "a2 = a:f()");
35 DOSTRING(L, "assert(a2:g() == 1)");