struct Luajit::LuaState
- Luajit::LuaState
- Struct
- Value
- Object
Defined in:
luajit/lua_state.crConstructors
Class Method Summary
-
.destroy(state : LuaState) : Nil
Destroys state and gives tracked values back to Crystal
Instance Method Summary
-
#abs_index(index : Int32) : Int32
Converts index into an equivalent absolute index
-
#assert_any!(index : Int32) : Nil
Raises
LuaError
unless there is a value at index -
#assert_bool!(index : Int32) : Nil
Raises
LuaError
unless the value at index is a boolean -
#assert_function!(index : Int32) : Nil
Raises
LuaError
unless the value at index is a function -
#assert_integer!(index : Int32) : Nil
Raises
LuaError
unless the value at index is a number -
#assert_light_userdata!(index : Int32) : Nil
Raises
LuaError
unless the value at index is a light userdata -
#assert_nil!(index : Int32) : Nil
Raises
LuaError
unless the value at index is nil -
#assert_number!(index : Int32) : Nil
Raises
LuaError
unless the value at index is a number -
#assert_string!(index : Int32, size : UInt64) : Nil
Raises
LuaError
unless the value at index is a string with size -
#assert_string!(index : Int32) : Nil
Raises
LuaError
unless the value at index is a string -
#assert_table!(index : Int32) : Nil
Raises
LuaError
unless the value at index is a table -
#assert_thread!(index : Int32) : Nil
Raises
LuaError
unless the value at index is a thread -
#assert_type!(index : Int32, type : LuaType) : Nil
Raises
LuaError
unless the value at index is type -
#assert_userdata!(index : Int32) : Nil
Raises
LuaError
unless the value at index is userdata -
#at_panic(cb : LuaCFunction) : LuaCFunction
https://www.lua.org/manual/5.1/manual.html#lua_atpanic
-
#at_panic(&block : LuaCFunction) : LuaCFunction
https://www.lua.org/manual/5.1/manual.html#lua_atpanic
-
#attach_metatable(index : Int32, tname : String) : Bool
Attaches a metatable to value at index with name tname if a metatable exists, otherwise returns
false
-
#c_pcall(&block : Function) : LuaStatus
Calls the C function block in protected mode
-
#call_metamethod(obj : Int32, event : String) : Bool
Calls a metamethod
-
#check_userdata!(index : Int32, tname : String) : Pointer(Void)
Checks whether the value at index is a userdata of type tname and returns it
-
#close : Nil
Destroys all objects and frees all dynamic memory
-
#co_resume(narg : Int32) : Int32
Starts and resumes a coroutine in a given thread
-
#co_yield(nresults : Int32) : Int32
Yields a coroutine
-
#concat(n : Int32) : Nil
Concatenates the n values at the top of the stack, pops them, and leaves the result at the top
-
#create_ref : LuaRef
Creates a
LuaRef
for object at top of stack -
#create_table(narr : Int32, nrec : Int32) : Nil
Creates a new empty table and pushes it onto the stack
-
#create_userdata(ptr : Pointer(Void), tname : String) : Pointer(UInt64)
Creates a full userdata with a type tname, and returns a pointer with the address of ptr
-
#eq(index1 : Int32, index2 : Int32) : Bool
Returns
true
if the two values in indices index1 and index2 are equal -
#execute(str : String) : LuaStatus
Loads and runs the given str
-
#execute(path : Path) : LuaStatus
Loads and runs the given path
-
#execute!(str : String) : Nil
Loads and runs the given str
-
#execute!(path : Path) : Nil
Loads and runs the given path
-
#gc : LuaGC
Returns
LuaGC
wrapper -
#get_environment(name : String) : Nil
Pushes onto the stack the value of the environment name
-
#get_fenv(index : Int32) : Nil
Pushes onto the stack the environment table of the value at index
-
#get_field(index : Int32, name : String) : Nil
Pushes onto the stack the value t[k], where t is the value at index, and k is the name of the field
-
#get_global(name : String) : Nil
Pushes onto the stack the value of the global name
-
#get_hook : LuaHook
Returns the current hook function
-
#get_hook_count : Int32
Returns the current hook count
-
#get_hook_mask : Int32
Returns the current hook mask
-
#get_info(what : String, ar : LuaDebug) : LuaDebug | Nil
Returns information about a specific function or function invocation
-
#get_local(ar : LuaDebug, n : Int32 = 1) : String | Nil
Gets information about a local variable of ar
-
#get_metafield(obj : Int32, e : String) : Bool
Pushes onto the stack the field e from the metatable of the object at index obj
-
#get_metatable(tname : String) : Nil
Pushes onto the stack the metatable associated with tname in the registry
-
#get_metatable(index : Int32) : Bool
Pushes onto the stack the metatable of the value at index
-
#get_ref_value(r : LuaRef) : Nil
Retrieves ref value for r
-
#get_registry(name : String) : Nil
Pushes onto the stack the value of the registry name
-
#get_stack(level : Int32) : LuaDebug | Nil
Get information about the interpreter runtime stack
-
#get_table(index : Int32) : Nil
Pushes onto the stack the value t[k], where t is the value at index, and k is the value at the top of the stack
-
#get_type(index : Int32) : LuaType
Returns the type of the value at the given index
-
#get_upvalue(fn_index : Int32, n : Int32) : String | Nil
Gets information about a closure's upvalue
-
#get_userdata(index : Int32, tname : String) : Pointer(Void)
Retrieves a full userdata at index with name tname and returns it
-
#insert(index : Int32) : Nil
Moves the top element into index, shifting elements above to open space
-
#is_bool?(index : Int32) : Bool
Returns
true
if value at the given index has type boolean -
#is_c_function?(index : Int32) : Bool
Returns
true
if value at the given index is a C function -
#is_function?(index : Int32) : Bool
Returns
true
if value at the given index is a function (either C or Lua) -
#is_light_userdata?(index : Int32) : Bool
Returns
true
if value at the given index is a light userdata -
#is_nil?(index : Int32) : Bool
Returns
true
if value at the given index is nil -
#is_none?(index : Int32) : Bool
Returns
true
if value at the given index is not valid (refers to an element outside the current stack) -
#is_none_or_nil?(index : Int32) : Bool
Returns
true
if value at the given index is not valid (refers to an element outside the current stack) or is nil -
#is_number?(index : Int32) : Bool
Returns
true
if value at the given index is a number or a string convertible to a number -
#is_pseudo?(index : Int32) : Bool
Returns
true
if index is a pseudo-index -
#is_string?(index : Int32) : Bool
Returns
true
if value at the given index is a string or a number (which is always convertible to a string) -
#is_table?(index : Int32) : Bool
Returns
true
if value at the given index is a table -
#is_thread?(index : Int32) : Bool
Returns
true
if value at the given index is a thread -
#is_userdata?(index : Int32) : Bool
Returns
true
if value at the given index is a userdata (either full or light) -
#less_than(index1 : Int32, index2 : Int32) : Bool
Returns
true
if the value at index1 is smaller than the value at index2 -
#new_metatable(tname : String) : Bool
Creates a new table to be used as a metatable for userdata, adds it to the registry with key tname, and returns
true
-
#new_table : Nil
Creates a new empty table and pushes it onto the stack
-
#new_thread : LuaState
Creates a new thread, represented as a new
LuaState
, and pushes it onto the stack -
#new_userdata(size : UInt64) : Pointer(Void)
Allocates a new block of memory with the given size, pushes onto the stack a new full userdata with the block address, and returns this address.
-
#new_userdata(size : Int32) : Pointer(Void)
Allocates a new block of memory with the given size, pushes onto the stack a new full userdata with the block address, and returns this address.
-
#next(index : Int32) : Bool
Pops a key from the stack, and pushes a key-value pair from the table at index (the "next" pair after the given key).
-
#open_library(type : LuaLibrary) : Nil
Opens standard Lua library type
-
#pcall(nargs : Int32, nresults : Int32, errfunc : Int32 = 0) : LuaStatus
Calls a function in protected mode
- #pcall(nargs : Int32, nresults : Int32, errfunc : Int32 = 0, & : LuaStatus -> ) : LuaStatus
-
#pop(n : Int32) : Nil
Pops n elements from the stack
-
#push(_x : Nil) : Nil
Pushes a
nil
value onto the stack -
#push(x : Float64) : Nil
Pushes a
Float64
onto the stack -
#push(x : Float32) : Nil
Pushes a
Float32
converted to aFloat64
onto the stack -
#push(x : Int64) : Nil
Pushes an
Int64
onto the stack -
#push(x : Int32) : Nil
Pushes an
Int32
converted to anInt64
onto the stack -
#push(x : String) : Nil
Pushes a
String
onto the stack -
#push(x : Char) : Nil
Pushes a
Char
converted to aString
onto the stack -
#push(x : Symbol) : Nil
Pushes a
Symbol
converted to aString
onto the stack -
#push(x : LuaCFunction) : Nil
Pushes a C function onto the stack
-
#push(x : Function) : Nil
Pushes a C closure onto the stack
-
#push(x : Bool) : Nil
Pushes a boolean onto the stack
-
#push(x : Pointer(Void)) : Nil
Pushes a light userdata onto the stack
- #push(x : Array) : Nil
- #push(x : Hash) : Nil
-
#push_fn(&block : LuaCFunction) : Nil
Pushes a C function onto the stack
-
#push_fn_closure(&block : Function) : Nil
Pushes a C closure onto the stack
-
#push_thread(x : LuaState) : ThreadStatus
Pushes thread represented by x onto the stack, returns
ThreadStatus
-
#push_value(index : Int32) : Nil
Pushes a copy of the element at index onto the stack
-
#raise_arg_error!(pos : Int32, reason : String) : NoReturn
Raises
LuaError
at pos with reason -
#raise_type_error!(pos : Int32, type : String) : NoReturn
Raises
LuaError
at pos with expected type -
#raw_eq(index1 : Int32, index2 : Int32) : Bool
Returns
true
if the two values in indices index1 and index2 are primitively equal -
#raw_get(index : Int32) : Nil
Similar to
#get_table
, but does a raw access (i.e., without metamethods) -
#raw_get_index(index : Int32, n : Int32) : Nil
Pushes onto the stack the value t[n], where t is the value at index, and n is an array-like index
-
#raw_set(index : Int32) : Nil
Similar to
#set_table
, but does a raw assignment (i.e., without metamethods) -
#raw_set_index(index : Int32, n : Int32) : Nil
Does the equivalent of t[n] = v, where t is the value at index, v is the value at the top of the stack, and n is an array-like index
-
#ref(index : Int32) : Int32
https://www.lua.org/manual/5.1/manual.html#luaL_ref
-
#ref_to_h(r : LuaRef) : Hash(String | Float64, LuaAny)
Convert r value to
Hash
-
#register(name : String, regs = [] of LuaReg) : Nil
Opens a library with name and registers all functions in regs
-
#register(regs : Array(LuaReg)) : Nil
Registers all functions in regs to table at the top of the stack
-
#register_fn(name : String, &block : Function) : Nil
Registers a named function to table at the top of the stack
-
#register_fn_global(name : String, &block : Function) : Nil
Registers a global function
-
#remove(index : Int32) : Nil
Removes the element at index, shifting down elements above to fill gap
-
#remove_ref(r : LuaRef) : Nil
Releases r so that it can be collected
-
#remove_ref(any : LuaAny) : Nil
Same as
#remove_ref
, but only if any is aLuaRef
-
#remove_refs(hash : Hash(String | Float64, LuaAny)) : Nil
Releases any
LuaRef
inside hash -
#replace(index : Int32) : Nil
Moves the top element into the given position (and pops it), without shifting any element (therefore replacing the value at the given position)
-
#set_environment(name : String) : Nil
Pops a value from the stack and sets it as the new value of environment name
-
#set_fenv(index : Int32) : Int32
Pops a table from the stack and sets it as the new environment for the value at index
-
#set_field(index : Int32, k : String) : Nil
Does the equivalent to t[k] = v, where t is the value at index, k is the key, and v is the value at top of stack.
-
#set_global(name : String) : Nil
Pops a value from the stack and sets it as the new value of global name
-
#set_hook(f : LuaHook, mask : Int32, count : Int32) : Nil
Sets the debugging hook function
-
#set_local(ar : LuaDebug, n : Int32 = 1) : String | Nil
Sets the value of a local variable of ar
-
#set_metatable(index : Int32) : Int32
Pops a table from the stack and sets it as the new metatable for the value at index
-
#set_registry(name : String) : Nil
Pops a value from the stack and sets it as the new value of registry name
-
#set_table(index : Int32) : Nil
Does the equivalent to t[k] = v, where t is the value at index, v is the value at top of stack, and k the value just behind v
-
#set_top(index : Int32) : Nil
Accepts any acceptable index, or 0, and sets the stack top to this index
-
#set_upvalue(fn_index : Int32, n : Int32) : String | Nil
Sets the value of a closure's upvalue
-
#size : Int32
Returns the index of the top element in the stack
-
#size_at(index : Int32) : UInt64
Returns the "length" of the value at index
-
#status : LuaStatus
Returns the status of
self
-
#to_a(index : Int32) : Array(LuaAny)
Converts value at index to
Array
-
#to_any?(index : Int32) : LuaAny | Nil
Converts value at index to
LuaAny
, otherwise returnsnil
-
#to_boolean(index : Int32) : Bool
Converts the Lua value at index to
Bool
-
#to_c_function!(index : Int32) : LuaCFunction
Same as
#to_c_function?
, but assumes value is notnil
-
#to_c_function?(index : Int32) : LuaCFunction | Nil
Converts a value at index to a C function, otherwise returns
nil
-
#to_f(index : Int32) : Float64
Converts the Lua value at index to
Float64
-
#to_f32(index : Int32) : Float32
Same as
#to_f64
but returns aFloat32
-
#to_f64(index : Int32) : Float64
Converts the Lua value at index to
Float64
-
#to_h(index : Int32) : Hash(String | Float64, LuaAny)
Converts value at index to
Hash
-
#to_i(index : Int32) : Int32
Same as
#to_i64
but returns aInt32
-
#to_i32(index : Int32) : Int32
Same as
#to_i64
but returns aInt32
-
#to_i64(index : Int32) : Int64
Converts the Lua value at index to
Int64
-
#to_pointer!(index : Int32) : Pointer(Void)
Same as
#to_pointer?
, but assumes value is notnil
-
#to_pointer?(index : Int32) : Pointer(Void) | Nil
Converts the value at index to a
Pointer
-
#to_string(index : Int32, size : UInt64) : String
Converts the Lua value at index to a C string
-
#to_string(index : Int32) : String
Converts the Lua value at index to a C string
-
#to_thread!(index : Int32) : LuaState
Same as
#to_thread?
, but assumes value is notnil
-
#to_thread?(index : Int32) : LuaState | Nil
Converts the value at index to a Lua thread, otherwise returns
nil
- #to_unsafe : Pointer(Void)
-
#to_userdata!(index : Int32) : Pointer(Void)
Same as
#to_userdata?
, but assumes value is notnil
-
#to_userdata?(index : Int32) : Pointer(Void) | Nil
If the value at index is a full userdata, returns its block address
-
#track(ptr : Pointer(Void)) : Nil
Add pointer to be tracked by Crystal
-
#type_name(lua_type : LuaType) : String
Returns the name of the lua_type value
-
#type_name_at(index : Int32) : String
Returns the name of the type of the value at the given index
-
#unref(index : Int32, ref : Int32) : Nil
https://www.lua.org/manual/5.1/manual.html#luaL_unref
-
#untrack(ptr : Pointer(Void)) : Nil
Remove pointer tracked by Crystal
-
#upvalue(index : Int32) : Int32
Produces upvalue indices
-
#version : Float64
Returns the version number of this core
-
#xmove(from : LuaState, to : LuaState, n : Int32) : Nil
Exchange values between different threads of the same global state
Constructor Detail
Class Method Detail
Destroys state and gives tracked values back to Crystal
Instance Method Detail
Raises LuaError
unless the value at index is a light userdata
Raises LuaError
unless the value at index is a string with size
Raises LuaError
unless the value at index is type
https://www.lua.org/manual/5.1/manual.html#lua_atpanic
https://www.lua.org/manual/5.1/manual.html#lua_atpanic
Attaches a metatable to value at index with name tname if
a metatable exists, otherwise returns false
Raises LuaError
if operation fails
Calls the C function block in protected mode
All values returned by block are discarded.
NOTE Adopted from Lua 5.3, because LuaJIT's version has some inconsistencies when dealing with error handling that made it hard to work with.
Calls a metamethod
If object at index obj has a metatable with field event, this
method calls this field and passes the object as its only argument.
In this case, returns true
and pushes onto the stack the value
returned by the call. Otherwise, returns false
and pushes nothing
onto the stack.
Checks whether the value at index is a userdata of type tname and returns it
Raises LuaError
unless tname matches
Starts and resumes a coroutine in a given thread
https://www.lua.org/manual/5.1/manual.html#lua_resume
Yields a coroutine
https://www.lua.org/manual/5.1/manual.html#lua_yield
Concatenates the n values at the top of the stack, pops them, and leaves the result at the top
If n == 1, does nothing
If n == 0, pushes empty string
Raises LuaError
if operation fails
Creates a LuaRef
for object at top of stack
Raises LuaError
if value at top of stack is nil
Raises LuaError
if ref cannot be created
Creates a new empty table and pushes it onto the stack
narr represents pre-allocated array elements
nrec represents pre-allocated non-array elements
Pre-allocation is useful when you know exactly how many elements the table will have.
Creates a full userdata with a type tname, and returns a pointer with the address of ptr
See #get_userdata
Returns true
if the two values in indices index1 and index2 are equal
Follows the semantics of the Lua ==
operator (i.e. may call metamethods)
Raises LuaError
if operation fails
Pushes onto the stack the value of the environment name
Raises LuaError
if operation fails
Pushes onto the stack the environment table of the value at index
Pushes onto the stack the value t[k], where t is the value at index, and k is the name of the field
As in Lua, this function may trigger a metamethod for the "index" event.
Raises LuaError
if operation fails
Pushes onto the stack the value of the global name
Raises LuaError
if operation fails
Returns information about a specific function or function invocation
https://www.lua.org/manual/5.1/manual.html#lua_getinfo
Gets information about a local variable of ar
https://www.lua.org/manual/5.1/manual.html#lua_getlocal
Pushes onto the stack the field e from the metatable of the object at index obj
If the object does not have a metatable, or if the metatable does not
have this field, returns false
and pushes nothing.
Pushes onto the stack the metatable associated with tname in the registry
Raises LuaError
if operation fails
See #new_metatable
Pushes onto the stack the metatable of the value at index
If index is not valid, or value does not have a metatable,
returns false
.
Pushes onto the stack the value of the registry name
Raises LuaError
if operation fails
Get information about the interpreter runtime stack
https://www.lua.org/manual/5.1/manual.html#lua_getstack
Pushes onto the stack the value t[k], where t is the value at index, and k is the value at the top of the stack
Pops the key from the stack (putting the resulting value in its place).
As in Lua, this function may trigger a metamethod for the "index" event
Raises LuaError
if operation fails
Returns the type of the value at the given index
Gets information about a closure's upvalue
https://www.lua.org/manual/5.1/manual.html#lua_getupvalue
Retrieves a full userdata at index with name tname and returns it
NOTE Can only be used if the userdata was originally created from
#create_userdata
.
Raises LuaError
if operation fails
Moves the top element into index, shifting elements above to open space
WARNING Cannot be called with a pseudo-index, because a pseudo-index is not an actual stack position.
Returns true
if value at the given index is a function (either C or Lua)
Returns true
if value at the given index is a light userdata
Returns true
if value at the given index is not valid (refers to an element outside the current stack)
Returns true
if value at the given index is not valid (refers to an element outside the current stack) or is nil
Returns true
if value at the given index is a number or a string convertible to a number
Returns true
if value at the given index is a string or a number (which is always convertible to a string)
Returns true
if value at the given index is a userdata (either full or light)
Returns true
if the value at index1 is smaller than the value at index2
Follows the semantics of the Lua <
operator (i.e. may call metamethods)
Raises LuaError
if operation fails
Creates a new table to be used as a metatable for userdata,
adds it to the registry with key tname, and returns true
If the registry already has the key tname, returns false
.
In both cases pushes onto the stack the final value associated with tname in the registry.
Creates a new thread, represented as a new LuaState
, and pushes it
onto the stack
Shares all global objects (such as tables), but has independent stack.
Allocates a new block of memory with the given size, pushes onto the stack a new full userdata with the block address, and returns this address.
Userdata represent C values in Lua. A full userdata represents a block of memory. It is an object (like a table): you must create it, it can have its own metatable, and you can detect when it is being collected. A full userdata is only equal to itself (under raw equality).
When Lua collects a full userdata with a gc metamethod, Lua calls the metamethod and marks the userdata as finalized. When this userdata is collected again then Lua frees its corresponding memory.
Allocates a new block of memory with the given size, pushes onto the stack a new full userdata with the block address, and returns this address.
Userdata represent C values in Lua. A full userdata represents a block of memory. It is an object (like a table): you must create it, it can have its own metatable, and you can detect when it is being collected. A full userdata is only equal to itself (under raw equality).
When Lua collects a full userdata with a gc metamethod, Lua calls the metamethod and marks the userdata as finalized. When this userdata is collected again then Lua frees its corresponding memory.
Pops a key from the stack, and pushes a key-value pair from the table at index (the "next" pair after the given key).
If there are no more elements in the table, then returns false
(and pushes nothing).
While traversing a table, do not call #to_string
directly on a key,
unless you know that the key is actually a string. Recall that
#to_string
changes the value at the given index; this confuses
the next call to #next
.
Raises LuaError
if operation fails
A typical traversal looks like this:
# table is in the stack at index 't'
state.push(nil)
while state.next(t)
# uses 'key' (at index -2) and 'value' (at index -1)
puts "#{state.type_name_at(-2)} - #{state.type_name_at(-1)}"
# removes 'value'; keeps 'key' for next iteration
state.pop(1)
end
Calls a function in protected mode
https://www.lua.org/manual/5.1/manual.html#lua_pcall
Pushes a light userdata onto the stack
A light userdata is equivalent to a Pointer
Pushes thread represented by x onto the stack, returns ThreadStatus
Raises LuaError
at pos with expected type
Returns true
if the two values in indices index1 and index2 are primitively equal
Does not call metamethods
Similar to #get_table
, but does a raw access (i.e., without metamethods)
Pushes onto the stack the value t[n], where t is the value at index, and n is an array-like index
The access is raw; that is, it does not invoke metamethods.
Similar to #set_table
, but does a raw assignment (i.e., without metamethods)
Does the equivalent of t[n] = v, where t is the value at index, v is the value at the top of the stack, and n is an array-like index
Pops the value from the stack.
The assignment is raw; that is, it does not invoke metamethods.
Opens a library with name and registers all functions in regs
Registers all functions in regs to table at the top of the stack
Registers a named function to table at the top of the stack
Raises LuaError
if operation fails
Registers a global function
Raises LuaError
if operation fails
Removes the element at index, shifting down elements above to fill gap
WARNING Cannot be called with a pseudo-index, because a pseudo-index is not an actual stack position.
Releases any LuaRef
inside hash
Moves the top element into the given position (and pops it), without shifting any element (therefore replacing the value at the given position)
Pops a value from the stack and sets it as the new value of environment name
Raises LuaError
if operation fails
Pops a table from the stack and sets it as the new environment for the value at index
If the value at index is neither a function, nor a thread, nor a userdata, returns 0. Otherwise returns 1.
Does the equivalent to t[k] = v, where t is the value at index, k is the key, and v is the value at top of stack.
Pops the value from the stack.
Raises LuaError
if operation fails
Pops a value from the stack and sets it as the new value of global name
Raises LuaError
if operation fails
Sets the debugging hook function
https://www.lua.org/manual/5.1/manual.html#lua_sethook
Sets the value of a local variable of ar
https://www.lua.org/manual/5.1/manual.html#lua_setlocal
Pops a table from the stack and sets it as the new metatable for the value at index
Pops a value from the stack and sets it as the new value of registry name
Raises LuaError
if operation fails
Does the equivalent to t[k] = v, where t is the value at index, v is the value at top of stack, and k the value just behind v
Pops both key and value from the stack.
Raises LuaError
if operation fails
Accepts any acceptable index, or 0, and sets the stack top to this index
If the new top is larger than the old one, then the new
elements are filled with nil
.
If index is 0, then all stack elements are removed.
Sets the value of a closure's upvalue
https://www.lua.org/manual/5.1/manual.html#lua_setupvalue
Returns the index of the top element in the stack
Because indices start at 1, this result is equal to the number of elements in the stack (and so 0 means an empty stack).
Returns the "length" of the value at index
For strings, this is the string length. For tables, this is the result of the length operator ('#'). For userdata, this is the size of the block of memory allocated for the userdata. For other values, it is 0.
Converts value at index to LuaAny
, otherwise returns nil
Converts the Lua value at index to Bool
Returns true
for any Lua value different than false
or nil
Returns false
when called with a non-valid index
Same as #to_c_function?
, but assumes value is not nil
Converts a value at index to a C function, otherwise returns nil
Converts the Lua value at index to Float64
The value must be a number or a string convertible to a number, otherwise returns 0
Converts the Lua value at index to Float64
The value must be a number or a string convertible to a number, otherwise returns 0
Converts value at index to Hash
Converts the Lua value at index to Int64
The value must be a number or a string convertible to a number, otherwise returns 0
If the number is not an integer, it is truncated in some non-specific way
Converts the value at index to a Pointer
The value can be a userdata, a table, a thread, or a function; otherwise, returns nil
.
Different objects will give different pointers. There is no way to convert the pointer back to its original value.
Converts the Lua value at index to a C string
The Lua value must be a string or a number, otherwise returns "".
If the value is a number, it also changes the actual value in the stack to a string.
Converts the Lua value at index to a C string
The Lua value must be a string or a number, otherwise returns "".
If the value is a number, it also changes the actual value in the stack to a string.
Same as #to_thread?
, but assumes value is not nil
Converts the value at index to a Lua thread, otherwise returns nil
Same as #to_userdata?
, but assumes value is not nil
If the value at index is a full userdata, returns its block address
If the value is a light userdata, returns its pointer
Otherwise returns nil
Returns the name of the type of the value at the given index
Exchange values between different threads of the same global state
https://www.lua.org/manual/5.1/manual.html#lua_xmove