Compare commits

..

3 Commits

Author SHA1 Message Date
75457e507d remove unused code 2024-10-21 19:13:57 -07:00
6a8f2a02b0 needs argument 2024-10-21 19:11:06 -07:00
eb2dd9d792 move register to set_globals 2024-10-21 19:10:58 -07:00
3 changed files with 3 additions and 15 deletions

View File

@ -42,8 +42,6 @@ fn init(lua:&mlua::Lua)->mlua::Result<()>{
super::number_sequence::set_globals(lua,&globals)?;
super::color_sequence::set_globals(lua,&globals)?;
lua.register_userdata_type::<super::script_signal::ScriptSignal>(mlua::UserData::register)?;
Ok(())
}

View File

@ -104,8 +104,8 @@ fn wait_thread(lua:&mlua::Lua,this:ScriptSignal)->Result<(),mlua::Error>{
const LUA_WAIT:&str=
"local coroutine_yield=coroutine.yield
local wait_thread=wait_thread
return function()
wait_thread()
return function(signal)
wait_thread(signal)
return coroutine_yield()
end";
@ -126,6 +126,7 @@ pub fn set_globals(lua:&mlua::Lua,globals:&mlua::Table)->Result<(),mlua::Error>{
lua.register_userdata_type::<ScriptSignal>(|reg|{
reg.add_field("Wait",wait);
mlua::UserData::register(reg);
})?;
Ok(())

View File

@ -2,14 +2,6 @@ pub use tick::Tick;
mod tick{
#[derive(Clone,Copy,Default,Hash,PartialEq,Eq,PartialOrd,Ord)]
pub struct Tick(u64);
impl Tick{
pub const fn new(value:u64)->Self{
Self(value)
}
pub const fn get(&self)->u64{
self.0
}
}
impl std::ops::Add<u64> for Tick{
type Output=Self;
fn add(self,rhs:u64)->Self::Output{
@ -40,9 +32,6 @@ pub struct Scheduler{
}
impl Scheduler{
pub const fn tick(&self)->Tick{
self.tick
}
pub fn has_scheduled_threads(&self)->bool{
!self.schedule.is_empty()
}