Struct gmod::lua::State

source · []
#[repr(transparent)]
pub struct State(pub *mut c_void);

Tuple Fields

0: *mut c_void

Implementations

Returns whether this is the clientside Lua state or not.

Returns whether this is the serverside Lua state or not.

Returns whether this is the menu Lua state or not.

Returns the Lua string as a slice of bytes.

WARNING: This will CHANGE the type of the value at the given index to a string.

Returns None if the value at the given index is not convertible to a string.

Returns the Lua string as a Rust UTF-8 String.

WARNING: This will CHANGE the type of the value at the given index to a string.

Returns None if the value at the given index is not convertible to a string.

This is a lossy operation, and will replace any invalid UTF-8 sequences with the Unicode replacement character. See the documentation for String::from_utf8_lossy for more information.

If you need raw data, use get_binary_string.

Returns the name of the type of the value at the given index.

Pops the stack, inserts the value into the registry table, and returns the registry index of the value.

Use from_reference with the reference index to push the value back onto the stack.

Use dereference to free the reference from the registry table.

Same as pcall, but ignores any runtime error and calls ErrorNoHaltWithStack instead with the error message.

Returns whether the execution was successful.

WARNING: Any Lua errors caused by calling the function will longjmp and prevent any further execution of your code.

To workaround this, use pcall_ignore, which will call ErrorNoHaltWithStack instead and allow your code to continue executing.

Creates a new table and pushes it to the stack. seq_n is a hint as to how many sequential elements the table may have. hash_n is a hint as to how many non-sequential/hashed elements the table may have. Lua may use these hints to preallocate memory.

Creates a new table and pushes it to the stack without memory preallocation hints. Equivalent to create_table(0, 0)

Exchange values between different threads of the same global state.

This function pops n values from the stack self, and pushes them onto the stack target_thread.

See call

See pcall_ignore

Creates a new table in the registry with the given name as the key if it doesn’t already exist, and pushes it onto the stack.

Returns if the metatable was already present in the registry.

what should start with > and pop a function off the stack

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.