[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: new "empty" value/type in Lua?
- From: Xavier Wang <weasley.wx@...>
- Date: Tue, 2 Jul 2013 06:11:27 +0800
this will be easy to implement in pure lua, if you need a C interface, also easy implement in C. (with current Lua implement).
just use a empty table/function as empty value, and modify type function to return "empty" if called with this value.
table.has only check this empty value, and table.delete just put this empty value to place.
IMHO, what Tim want is just a "standard way" to something, in this topic, the "empty value" in array, but in facts, there are so many thing in Lua that indeed need a standard way. what about exception? what about OO?
the real question is, how to define a standard way, makes all Luaer works with it, but not affect the simply of Lua?
maybe we need something like lua manual, it's a standard, but not the Lua language, it's for the Lua usage, e.g. return nil, errmsg[, others] for error case, etc. and this empty value can put in this standard document.
or, some "std library", disturbed with Lua source, as a part of Lua language, but description of it is at other place (maybe it's the standard lua usage document).