NAME ^

pmc/luanil.pmc - Lua Nil

DESCRIPTION ^

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?).

Methods ^

PMC *new_from_string(STRING *rep, INTVAL flags)

Allow :

    .const .LuaNil nil = "dummy"
STRING *name()

Return the string "nil".

PMC *clone()

Creates and returns a clone of the scalar.

STRING *get_string ()

Return the string "nil".

INTVAL get_bool()

Return always false.

INTVAL defined()

"nil" in Lua is always undefined.

non-Vtable Methods ^

INTVAL is_equal (PMC *value)

Specific Methods ^

PMC *rawequal (PMC *value)

AUTHORS ^

Original code by Klaas-Jan Stol.


parrot