diff options
Diffstat (limited to 'deep_test')
-rw-r--r-- | deep_test/deep_test.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/deep_test/deep_test.cpp b/deep_test/deep_test.cpp index 0c7ed0f..dbc0115 100644 --- a/deep_test/deep_test.cpp +++ b/deep_test/deep_test.cpp | |||
@@ -8,6 +8,8 @@ class MyDeepFactory : public DeepFactory | |||
8 | static MyDeepFactory Instance; | 8 | static MyDeepFactory Instance; |
9 | 9 | ||
10 | private: | 10 | private: |
11 | |||
12 | private: | ||
11 | void createMetatable(lua_State* const L_) const override | 13 | void createMetatable(lua_State* const L_) const override |
12 | { | 14 | { |
13 | luaL_getmetatable(L_, "deep"); | 15 | luaL_getmetatable(L_, "deep"); |
@@ -164,6 +166,14 @@ static luaL_Reg const deep_mt[] = { | |||
164 | 166 | ||
165 | // ################################################################################################# | 167 | // ################################################################################################# |
166 | 168 | ||
169 | int luaD_get_deep_count(lua_State* const L_) | ||
170 | { | ||
171 | lua_pushinteger(L_, MyDeepFactory::Instance.getObjectCount()); | ||
172 | return 1; | ||
173 | } | ||
174 | |||
175 | // ################################################################################################# | ||
176 | |||
167 | int luaD_new_deep(lua_State* L) | 177 | int luaD_new_deep(lua_State* L) |
168 | { | 178 | { |
169 | UserValueCount const _nuv{ static_cast<int>(luaL_optinteger(L, 1, 0)) }; | 179 | UserValueCount const _nuv{ static_cast<int>(luaL_optinteger(L, 1, 0)) }; |
@@ -296,6 +306,7 @@ int luaD_new_clonable(lua_State* L) | |||
296 | // ################################################################################################# | 306 | // ################################################################################################# |
297 | 307 | ||
298 | static luaL_Reg const deep_module[] = { | 308 | static luaL_Reg const deep_module[] = { |
309 | { "get_deep_count", luaD_get_deep_count }, | ||
299 | { "new_deep", luaD_new_deep }, | 310 | { "new_deep", luaD_new_deep }, |
300 | { "new_clonable", luaD_new_clonable }, | 311 | { "new_clonable", luaD_new_clonable }, |
301 | { nullptr, nullptr } | 312 | { nullptr, nullptr } |