Constructs a lua function with id for its function name
in scope with some closure to be written to the metamethod
'__call'. A required def is needed to determine the input
arguments and other runtime information.
Query if std "print" can print the value.
This is short for asking if the lua object is a table
or a function, which would return the address in the VM
at runtime for this lua obejct.
In lua, all values have a truthyness which
means they can be used in conditional statements.
If value is null or false, then the result is false.
All other values and the result is true.
If this lua object is a table, then the result is true.
Returns the lua equivalent runtime type
information. The result is the same as
what lua type(x) would return. This
is useful for quick type checking and
printing helpful error messages.
Begins at field "1" and increments this string
until no field is found with that key. Returns the
largest integer field found minus one.
This mimics lua's table len (#) behavior.
Inspects the result of readField with key.
If the result's type is LuaObject, then
it also inspects its this.value.
If the underlying value type is T, then
it is returned. If no underlying value type
matches T, then or is returned.
Whenever a lua object's fields or value is modified (written),
executes callback. If the lua object's storage is value, then
the first argument of callback will be 'self'. Otherwise it is
the string name of the field's key.
Due to a dart bug, I cannot throw if we're converting a table
or some other unknown data type to a string.
Instead, unhandled types return their variable name wrapped
in angle brackets <>. I'll check for string type conversion
as-needed instead.
Inspects this.value. If the type
is LuaObject, inspects its this.value.
If the underlying value type is T, then
it is returned. If no underlying value type
matches T, the null is returned.
Tries to cast this.value as num
and performs a lossy integer division
to obtain the leading part of the double.
If the leading part is equal to the double
representation, the value must be a whole number
and therefore an integer. Otherwise, loss happened
and it must be a real number and therefore a double.
If the underlying type of this.value is not num
then null is returned.
If this lua object is a table, then
it writes value to key and returns the field key.
Otherwise if the lua object is not a table, then null is returned.