diff options
Diffstat (limited to 'unit_tests/shared.cpp')
| -rw-r--r-- | unit_tests/shared.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/unit_tests/shared.cpp b/unit_tests/shared.cpp index 9f3b08e..825cd48 100644 --- a/unit_tests/shared.cpp +++ b/unit_tests/shared.cpp | |||
| @@ -46,8 +46,14 @@ namespace | |||
| 46 | return 1; | 46 | return 1; |
| 47 | }; | 47 | }; |
| 48 | 48 | ||
| 49 | // a function that creates a full userdata, using first argument as its metatable | ||
| 49 | lua_CFunction sNewUserData = +[](lua_State* const L_) { | 50 | lua_CFunction sNewUserData = +[](lua_State* const L_) { |
| 50 | std::ignore = luaW_newuserdatauv<int>(L_, UserValueCount{ 0 }); | 51 | lua_settop(L_, 1); // L_: {}|nil |
| 52 | STACK_CHECK_START_ABS(L_, 1); | ||
| 53 | std::ignore = luaW_newuserdatauv<int>(L_, UserValueCount{ 0 }); // L_: {}|nil u | ||
| 54 | lua_insert(L_, 1); // L_: u {}|nil | ||
| 55 | lua_setmetatable(L_, 1); // L_: u | ||
| 56 | STACK_CHECK(L_, 1); | ||
| 51 | return 1; | 57 | return 1; |
| 52 | }; | 58 | }; |
| 53 | 59 | ||
