Teach adopt() to hold the adopted pointer in custom pointer type.
[luabind.git] / test / test_set_instance_value.cpp
blob844d0cfca64dc682ca3d4833c9020ba51e7a9502
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)
5 #include "test.hpp"
6 #include <luabind/luabind.hpp>
8 void test_main(lua_State* L)
10 DOSTRING(L,
11 "class 'X'\n"
12 " function X:__init()\n"
13 " self.value = 1\n"
14 " self.second = 2\n"
15 " end\n"
16 "\n"
17 "x = X()\n"
18 "assert(x.value == 1)\n"
19 "assert(x.second == 2)\n"
20 "x.value = 2\n"
21 "assert(x.value == 2)\n"
22 "assert(x.second == 2)\n"
23 "x.second = 3\n"
24 "y = X()\n"
25 "assert(y.value == 1)\n"
26 "assert(y.second == 2)\n"
27 "assert(x.value == 2)\n"
28 "assert(x.second == 3)\n"