parrotcode: Lua Nil | |
Contents | Language Implementations | Lua |
pmc/luanil.pmc - Lua Nil
LuaNil
provides a class with the behaviour of the Lua Nil
value.
Implementation is based on the Undef PMC.
LuaNil is no longer a singleton; this would be a problem,
as all uninitialized values in Lua are LuaNil.
If some value is assigned,
the LuaNil should morph into the correct type,
and so a new PMC is constructed anyway.
Therefore,
we may as well create a new PMC right away.
Also,
creating a new PMC from a singleton class is troublesome (if not possible?).
PMC *new_from_string(STRING *rep, INTVAL flags)
.const .LuaNil nil = "dummy"
STRING *name()
STRING *get_string ()
INTVAL get_bool()
false
.INTVAL defined()
Original code by Klaas-Jan Stol.
|