Modified Machine to take a State, partially implemented metamethods, refactored for adopting freelists. Fails build; in progress.
This commit is contained in:
parent
60c097518a
commit
db0ff1348c
13 changed files with 632 additions and 871 deletions
18
src/core.rs
Normal file
18
src/core.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
use crate::vm::{Machine, ForeignFunction, Needle, RunError};
|
||||
pub(crate) fn load<S>(machine: &mut Machine<S>) -> Result<(),RunError> {
|
||||
machine.set_global_function("print",|machine: &mut Machine<S>, mut needle: Needle| {
|
||||
while let Some(value) = needle.pop() {
|
||||
print!("{} ", machine.meta_to_string(needle.dispatch, value)?.unwrap_str())
|
||||
}
|
||||
println!();
|
||||
Ok(())
|
||||
})?;
|
||||
machine.set_global_function("debug",|_machine: &mut Machine<S>, mut needle: Needle| {
|
||||
while let Some(value) = needle.pop() {
|
||||
print!("{:?} ", value)
|
||||
}
|
||||
println!();
|
||||
Ok(())
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue