[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: table.clear
- From: Andrew Starks <andrew.starks@...>
- Date: Fri, 13 Dec 2013 12:52:23 -0600
I was working with defining an "object" that holds a list. Due some
ways in which it'd be used, the list has a metatable. When someone
sets the list to `nil`, i need to clear it.
This made me think of the past discussion about 5.3 having a
table.clear/wipe method[1].
If this does happen, I humbly throw out that the following would be helpful:
1: It not wipe out the metatable.
2: There be a __clear/wipe metamethod so that I can use the same call
and also catch any cleanup that may need to happen as a result, in
cases where a simple wipe would be problematic.
--Andrew
[1]: http://lua-users.org/lists/lua-l/2013-11/msg00669.html