Values¶
- class mehtap.values.Variable(value: LuaValue, constant: bool = False, to_be_closed: bool = False)¶
Bases:
objectTuple of a Lua value and its properties describing a local variable.
- class mehtap.values.LuaValue¶
Bases:
ABCBase class that all Lua values inherit from.
- set_metatable(value: LuaTable)¶
Set the value’s metatable if the value can have one.
- Raises:
NotImplementedError – if the value can’t have a metatable
- Parameters:
value (LuaTable)
- remove_metatable()¶
Removes the value’s metatable if the value can have one.
Does nothing if the value can’t have a metatable
- mehtap.values.LuaNil = LuaNil¶
Value that is different from all other LuaValues.
Represents the value of the nil basic type in Lua. Sole object of the
LuaNilTypeclass.
- class mehtap.values.LuaBool(true: bool)¶
Bases:
LuaValueClass representing values of the boolean basic type in Lua.
- Parameters:
true (bool)
- class mehtap.values.LuaNumberType(value)¶
Bases:
EnumEnumeration of the types of numbers in Lua.
- INTEGER = 1¶
Number type that represents 64-bit signed integers.
- FLOAT = 2¶
Number type that represents double-precision floating point numbers.
- class mehtap.values.LuaNumber(value: int | float, type: LuaNumberType | None = None)¶
Bases:
LuaValueClass representing values of the number basic type in Lua.
- Parameters:
value (int | float) – The underlying value of this number value.
type (LuaNumberType | None) – The type of this number value. If provided, must match the type of
value.
- type: LuaNumberType | None¶
The type of this number value.
- class mehtap.values.LuaString(content: bytes)¶
Bases:
LuaValueClass representing values of the string basic type in Lua.
- Parameters:
content (bytes)
- class mehtap.values.LuaObject¶
-
Base class that Lua objects inherit from.
Tables,functions,threadsand(full) userdata valuesare objects. See Lua 5.4 Reference Manual, Section 2.1.
- class mehtap.values.LuaCallableABC¶
Bases:
ABCAbstract base class for objects that can be called.
If a type that is not a subclass of this class is attempted to be called in execution, a
LuaErrorwill be raised.
- class mehtap.values.LuaFunction(param_names: list[LuaString], variadic: bool, parent_scope: Scope | None, block: Block | Callable, gets_scope: bool = False, name: str | None = None, min_req: int | None = None, signature: str | None = None)¶
Bases:
LuaObject,LuaCallableABCClass representing values of the function basic type in Lua.
- Parameters:
- param_names: list[LuaString]¶
The names of the parameters of the function.
Used when binding given arguments to the block scope when calling the function or when pretty-displaying the function.
- variadic: bool¶
Whether the function is a variadic function.
That is, a function that accepts a variable number of arguments, binding the excess arguments to the expression “
...”.
- parent_scope: Scope | None¶
The scope the function was defined in.
The function can access any of these values as upvalues. Not applicable for functions defined from Python.
- block: Block | Callable¶
The code that the function executes.
If of type
Block, the function is implemented in Lua. If of typeCallable, the function is implemented in Python.The
call()method should be used to call the function.
- gets_scope: bool¶
Whether the function receives the scope as its first argument.
Only applicable for functions implemented in Python.
- min_req: int | None¶
The minimum number of required arguments.
Only applicable for functions implemented in Python. Only used for pretty-displaying the function.
- rawcall(args: Multires, scope: Scope | None, *, modify_tb: bool = True) list[LuaValue]¶
Call the function.
- Parameters:
- Returns:
A multires list of the return values of the function.
- Return type:
The number of arguments will be suitably adjusted to the number of the function’s arguments according to the rules on adjustment of Lua. Can contain multires expressions.
- class mehtap.values.LuaUserdata¶
Bases:
LuaObjectClass representing values of the userdata basic type in Lua.
Users can define their own userdata types by subclassing this class. An example of a subclass of this class is
LuaFile.
- class mehtap.values.LuaThread¶
Bases:
LuaObjectClass representing values of the thread basic type in Lua.
- class mehtap.values.LuaIndexableABC¶
-
Abstract base class for objects that can be indexed.
If a type that is not a subclass of this class is attempted to be indexed in execution, a
LuaErrorwill be raised.
- class mehtap.values.LuaTable(map: dict[LuaValue, LuaValue] = NOTHING, metatable: LuaTable | None = None)¶
Bases:
LuaObject,LuaIndexableABCClass representing values of the table basic type in Lua.
- rawget(key: LuaValue)¶
Get the associated value of a key from the object.
- Parameters:
key (LuaValue)