pub struct LuaEnv { /* private fields */ }Implementations§
source§impl LuaEnv
impl LuaEnv
pub fn new(chunk: Chunk) -> LuaEnv
pub fn main_thread(&self) -> &Rc<RefCell<LuaThread>>
pub fn running_thread(&self) -> &Rc<RefCell<LuaThread>>
pub fn push(&self, value: LuaValue)
pub fn push2(&self, value1: LuaValue, value2: LuaValue)
pub fn push3(&self, value1: LuaValue, value2: LuaValue, value3: LuaValue)
pub fn pop(&self) -> LuaValue
pub fn pop2(&self) -> (LuaValue, LuaValue)
pub fn pop3(&self) -> (LuaValue, LuaValue, LuaValue)
pub fn pop4(&self) -> (LuaValue, LuaValue, LuaValue, LuaValue)
pub fn pop_n(&self, n: usize)
pub fn top(&self) -> LuaValue
pub fn borrow_running_thread(&self) -> Ref<'_, LuaThread>
pub fn borrow_running_thread_mut(&self) -> RefMut<'_, LuaThread>
pub fn get_metavalue(&self, value: &LuaValue, key: &str) -> Option<LuaValue>
sourcepub fn tostring(&mut self) -> Result<(), RuntimeError>
pub fn tostring(&mut self) -> Result<(), RuntimeError>
string-fy a value
sourcepub fn add(&mut self) -> Result<(), RuntimeError>
pub fn add(&mut self) -> Result<(), RuntimeError>
add operation with __add metamethod
sourcepub fn sub(&mut self) -> Result<(), RuntimeError>
pub fn sub(&mut self) -> Result<(), RuntimeError>
sub operation with __sub metamethod
sourcepub fn mul(&mut self) -> Result<(), RuntimeError>
pub fn mul(&mut self) -> Result<(), RuntimeError>
mul operation with __mul metamethod
sourcepub fn div(&mut self) -> Result<(), RuntimeError>
pub fn div(&mut self) -> Result<(), RuntimeError>
div operation with __div metamethod
sourcepub fn mod_(&mut self) -> Result<(), RuntimeError>
pub fn mod_(&mut self) -> Result<(), RuntimeError>
mod operation with __mod metamethod
sourcepub fn pow(&mut self) -> Result<(), RuntimeError>
pub fn pow(&mut self) -> Result<(), RuntimeError>
pow operation with __pow metamethod
sourcepub fn unm(&mut self) -> Result<(), RuntimeError>
pub fn unm(&mut self) -> Result<(), RuntimeError>
unary minus operation with __unm metamethod
sourcepub fn idiv(&mut self) -> Result<(), RuntimeError>
pub fn idiv(&mut self) -> Result<(), RuntimeError>
floor division operation with __idiv metamethod
sourcepub fn band(&mut self) -> Result<(), RuntimeError>
pub fn band(&mut self) -> Result<(), RuntimeError>
bitwise and operation with __band metamethod
sourcepub fn bor(&mut self) -> Result<(), RuntimeError>
pub fn bor(&mut self) -> Result<(), RuntimeError>
bitwise or operation with __bor metamethod
sourcepub fn bxor(&mut self) -> Result<(), RuntimeError>
pub fn bxor(&mut self) -> Result<(), RuntimeError>
bitwise xor operation with __bxor metamethod
sourcepub fn shl(&mut self) -> Result<(), RuntimeError>
pub fn shl(&mut self) -> Result<(), RuntimeError>
bitwise shift left operation with __shl metamethod
sourcepub fn shr(&mut self) -> Result<(), RuntimeError>
pub fn shr(&mut self) -> Result<(), RuntimeError>
bitwise shift right operation with __shr metamethod
sourcepub fn bnot(&mut self) -> Result<(), RuntimeError>
pub fn bnot(&mut self) -> Result<(), RuntimeError>
bitwise not operation with __bnot metamethod
sourcepub fn concat(&mut self) -> Result<(), RuntimeError>
pub fn concat(&mut self) -> Result<(), RuntimeError>
concat operation with __concat metamethod
sourcepub fn len(&mut self) -> Result<(), RuntimeError>
pub fn len(&mut self) -> Result<(), RuntimeError>
# length operation with __len metamethod
sourcepub fn index(&mut self) -> Result<(), RuntimeError>
pub fn index(&mut self) -> Result<(), RuntimeError>
table index get operation with __index metamethod
sourcepub fn newindex(&mut self) -> Result<(), RuntimeError>
pub fn newindex(&mut self) -> Result<(), RuntimeError>
table index set operation with __newindex metamethod
sourcepub fn eq(&mut self) -> Result<(), RuntimeError>
pub fn eq(&mut self) -> Result<(), RuntimeError>
equality operation with __eq metamethod
sourcepub fn lt(&mut self) -> Result<(), RuntimeError>
pub fn lt(&mut self) -> Result<(), RuntimeError>
less than operation with __lt metamethod
sourcepub fn le(&mut self) -> Result<(), RuntimeError>
pub fn le(&mut self) -> Result<(), RuntimeError>
less than or equal operation with __le metamethod
sourcepub fn function_call(
&mut self,
args_num: usize,
func: LuaValue,
expected_ret: Option<usize>,
force_wait: bool,
) -> Result<(), RuntimeError>
pub fn function_call( &mut self, args_num: usize, func: LuaValue, expected_ret: Option<usize>, force_wait: bool, ) -> Result<(), RuntimeError>
function call with __call metamethod.
if force_wait is true, this does not return until the function call is finished.
that is, if force_wait is false, this function just pushes data to the function-call-stack, and returns.
user must call run_instruction to actually run the function.
sourcepub fn run_instruction(
&mut self,
instruction: Instruction,
) -> Result<(), RuntimeError>
pub fn run_instruction( &mut self, instruction: Instruction, ) -> Result<(), RuntimeError>
execute single instruction
pub fn cycle(&mut self) -> Result<bool, RuntimeError>
sourcepub fn run(&mut self) -> Result<(), RuntimeError>
pub fn run(&mut self) -> Result<(), RuntimeError>
run the whole chunk