* Method: deallocation for DF object references. */
| 960 | * Method: deallocation for DF object references. |
| 961 | */ |
| 962 | static int meta_delete(lua_State *state) |
| 963 | { |
| 964 | int argc = lua_gettop(state); |
| 965 | |
| 966 | if (argc != 1) |
| 967 | luaL_error(state, "Usage: object:delete() or df.delete(object)"); |
| 968 | |
| 969 | if (lua_isnil(state, 1)) |
| 970 | { |
| 971 | lua_pushboolean(state, true); |
| 972 | return 1; |
| 973 | } |
| 974 | |
| 975 | const type_identity *id = get_object_identity(state, 1, "df.delete()", false); |
| 976 | |
| 977 | bool ok = id->destroy(get_object_ref(state, 1)); |
| 978 | |
| 979 | lua_pushboolean(state, ok); |
| 980 | return 1; |
| 981 | } |
| 982 | |
| 983 | /** |
| 984 | * Verify that the object is a DF ref with UPVAL_METATABLE. |
nothing calls this directly
no test coverage detected