parrotcode: Lua Nil | |
Contents | Language Implementations | Lua |
pmc/luanil.pmc - Lua Nil
LuaNil
extends LuaAny
to provide a class with the behaviour of the Lua Nil
type.
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()
PMC *clone()
STRING *get_string()
INTVAL get_bool()
false
.INTVAL defined()
Original code by Klaas-Jan Stol.
|