Struct td_rlua::Lua
[−]
[src]
pub struct Lua { // some fields omitted }
Methods
impl Lua
[src]
fn new() -> Lua
Builds a new Lua context.
Panic
The function panics if the underlying call to luaL_newstate
fails
(which indicates lack of memory).
fn state(&mut self) -> *mut lua_State
fn clone(&mut self) -> Lua
fn set_own(&mut self, own: bool)
fn from_existing_state(lua: *mut lua_State, close_at_the_end: bool) -> Lua
Takes an existing lua_State
and build a Lua object from it.
Arguments
close_at_the_end
: if true, lua_close will be called on the lua_State on the destructor
fn register<I>(&mut self, index: I, func: extern fn(*mut lua_State) -> c_int) -> i32 where I: Borrow<str>
fn openlibs(&mut self)
Opens all standard Lua libraries.
This is done by calling luaL_openlibs
.
fn query<'l, V, I>(&'l mut self, index: I) -> Option<V> where I: Borrow<str>, V: LuaRead
Reads the value of a global variable.
fn set<I, V>(&mut self, index: I, value: V) where I: Borrow<str>, V: LuaPush
Modifies the value of a global variable.
fn exec_string<'a, I, R>(&'a mut self, index: I) -> Option<R> where I: Borrow<str>, R: LuaRead
fn empty_table<I>(&mut self, index: I) -> LuaTable where I: Borrow<str>
Inserts an empty table, then loads it.
fn add_lualoader(&mut self, func: extern fn(*mut lua_State) -> c_int) -> i32
fn load_file(&mut self, file_name: &str) -> i32
fn enable_hotfix(&mut self)
enable hotfix, can update the new func, and the old data will be keep and bind to the new func