Modified Machine to take a State, partially implemented metamethods, refactored for adopting freelists. Fails build; in progress.

This commit is contained in:
paladin 2026-09-28 02:04:17 +01:00
parent 60c097518a
commit db0ff1348c
13 changed files with 632 additions and 871 deletions

18
src/core.rs Normal file
View 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(())
}