|
@@ -56,11 +56,9 @@ TEST_CASE("UserTypeFields") {
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
// Instantiation
|
|
// Instantiation
|
|
|
- luwra::Value<B&>::push(state, 1338);
|
|
|
|
|
|
|
+ B& value = luwra::construct<B>(state, 1338);
|
|
|
lua_setglobal(state, "value");
|
|
lua_setglobal(state, "value");
|
|
|
|
|
|
|
|
- B& value = luwra::getGlobal<B&>(state, "value");
|
|
|
|
|
-
|
|
|
|
|
// Unqualified get
|
|
// Unqualified get
|
|
|
REQUIRE(luaL_dostring(state, "return value:n()") == 0);
|
|
REQUIRE(luaL_dostring(state, "return value:n()") == 0);
|
|
|
puts(lua_tostring(state, -1));
|
|
puts(lua_tostring(state, -1));
|
|
@@ -134,11 +132,9 @@ TEST_CASE("UserTypeMethods") {
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
// Instantiation
|
|
// Instantiation
|
|
|
- luwra::Value<C&>::push(state, 1337);
|
|
|
|
|
|
|
+ C& value = luwra::construct<C>(state, 1337);
|
|
|
lua_setglobal(state, "value");
|
|
lua_setglobal(state, "value");
|
|
|
|
|
|
|
|
- C& value = luwra::getGlobal<C&>(state, "value");
|
|
|
|
|
-
|
|
|
|
|
// Unqualified method
|
|
// Unqualified method
|
|
|
REQUIRE(luaL_dostring(state, "return value:foo1(63)") == 0);
|
|
REQUIRE(luaL_dostring(state, "return value:foo1(63)") == 0);
|
|
|
REQUIRE(value.prop == 1400);
|
|
REQUIRE(value.prop == 1400);
|
|
@@ -171,7 +167,7 @@ TEST_CASE("UserTypeGarbageCollectionRef") {
|
|
|
REQUIRE(shared_var.use_count() == 1);
|
|
REQUIRE(shared_var.use_count() == 1);
|
|
|
|
|
|
|
|
// Copy construction
|
|
// Copy construction
|
|
|
- luwra::push<std::shared_ptr<int>&>(state, shared_var);
|
|
|
|
|
|
|
+ luwra::push(state, shared_var);
|
|
|
REQUIRE(shared_var.use_count() == 2);
|
|
REQUIRE(shared_var.use_count() == 2);
|
|
|
|
|
|
|
|
// Garbage collection
|
|
// Garbage collection
|