NAME ^

pmc/luatable.pmc - Lua Table

DESCRIPTION ^

LuaTable extends LuaBase to provide a class with the behaviour of the Lua Table type.

This implementation is based on the Lua 4.0 one.

Overloaded Methods ^

void init()

Initializes the instance.

void mark()

Marks the hash as live.

void destroy()

Free hash structure.

STRING *name()

Return the string "table".

PMC *clone()

PMCs are always handled by-reference in Parrot. So, copying register contents only copies the reference to the PMC. For LuaString, LuaNumber, LuaBoolean, this is not correct, as Lua has by-value semantics for these types. In order to be able to handle register "move" instructions, this should be implemented using clone(). However, LuaTable and LuaFunction do have by-reference semantics. As you don't know the type during compile-time of an object, just always use clone() to copy register contents. LuaTable and LuaFunction should therefore only clone the reference to themselves, not make a deep copy.

STRING *get_string()

void set_pmc(PMC *other)

PMC *get_pmc_keyed (PMC *key)

table accessor.

void set_pmc_keyed(PMC *key, PMC *value)

table mutator.

void set_pmc_keyed_str(STRING *key, PMC *value)

Need by NameSpace.export_to().

INTVAL elements()

Returns the number of elements in the table.

non-Vtable Methods ^

INTVAL is_equal(PMC *value)

The == operation. Compares reference (not in depth).

INTVAL cmp(PMC *value)

Specific Methods ^

PMC *get_metatable()

PMC *len()

PMC *next(PMC *index)

PMC *rawequal(PMC *value)

PMC *rawget(PMC *key)

void rawset(PMC *key, PMC *value)

void set_metatable(PMC *meta)

AUTHORS ^

Francois Perrad

Klaas-Jan Stol


parrot