Crate locenv

Crate locenv 

Source

Modules§

api

Macros§

error
A helper macro that combine error_with_message and format together.

Structs§

Context
Represents the execution context of the current function.
FunctionEntry
Represents a function to add to a Lua table.
MethodEntry
Represents a method of a Lua object.

Constants§

LUAI_IS32INT
LUAI_MAXSTACK
LUA_REGISTRYINDEX
LUA_TBOOLEAN
LUA_TFUNCTION
LUA_TLIGHTUSERDATA
LUA_TNIL
LUA_TNUMBER
LUA_TSTRING
LUA_TTABLE
LUA_TTHREAD
LUA_TUSERDATA

Statics§

API_TABLE

Traits§

Closure
A trait for implement Lua closure.
Object
A trait for implement Lua object.
UserData
A trait to allow Rust object to be able to get collected by Lua GC.

Functions§

abs_index
Converts the acceptable index index into an equivalent absolute index (that is, one that does not depend on the stack size).
argument_error
Raises an error reporting a problem with argument arg of the function that called it, using a standard message that includes comment as a comment:
check_string
Checks whether the function argument arg is a string and returns this string.
create_table
Creates a new empty table and pushes it onto the stack. Parameter elements is a hint for how many elements the table will have as a sequence; parameter fields is a hint for how many other elements the table will have. Lua may use these hints to preallocate memory for the new table. This preallocation may help performance when you know in advance how many elements the table will have.
error
Raises a Lua error, using the value on the top of the stack as the error object.
error_with_message
Raises a Lua error with the specified message.
get_field
Pushes onto the stack the value t[key], where t is the value at the given index. As in Lua, this function may trigger a metamethod for the “index” event.
is_none_or_nil
Returns true if the given index is not valid or if the value at this index is nil, and false otherwise.
new_userdata
This function creates and pushes on the stack a new full userdata, with Rust object associated Lua values.
opt_string
If the function argument arg is a string, returns this string. If this argument is absent or is nil, returns None. Otherwise, raises an error.
pop
Pops count elements from the stack.
push_closure
Pushes a new closure onto the stack.
push_fn
Pushes a new function onto the stack.
push_nil
Pushes a nil value onto the stack.
push_str
Pushes a string onto the stack. The string can contain any binary data, including embedded zeros.
push_value
Pushes a copy of the element at the given index onto the stack.
set_field
Does the equivalent to t[key] = v, where t is the value at the given index and v is the value on the top of the stack.
set_functions
Registers all functions in the entries into the table on the top of the stack. When upvalues is not zero, all functions are created with upvalues upvalues, initialized with copies of the upvalues values previously pushed on the stack on top of the library table. These values are popped from the stack after the registration.
set_metatable
Pops a table or nil from the stack and sets that value as the new metatable for the value at the given index (nil means no metatable).
to_string
Converts the Lua value at the given index to a string.
type_error
Raises a type error for the argument arg of the function that called it, using a standard message; expect is a “name” for the expected type.
upvalue_index
Returns the pseudo-index that represents the i-th upvalue of the running function. i must be in the range [1,256].

Type Aliases§

Method