added basic callback support to ClientManager
This commit is contained in:
parent
b29d055aa1
commit
6ebdb441e1
|
|
@ -12,7 +12,7 @@ use uuid::Uuid;
|
|||
|
||||
use async_trait::async_trait;
|
||||
use mlua::prelude::LuaUserData;
|
||||
use mlua::{MetaMethod, Nil, ToLua, UserDataFields, UserDataMethods};
|
||||
use mlua::{Function, MetaMethod, Nil, ToLua, UserDataFields, UserDataMethods};
|
||||
use mlua::Value::UserData;
|
||||
|
||||
use foundation::prelude::IManager;
|
||||
|
|
@ -195,11 +195,11 @@ impl<Out> IManager for ClientManager<Out>
|
|||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ClientManagerLua<Out: 'static>(pub Arc<ClientManager<Out>>)
|
||||
pub struct ClientManagerLua<'lua, Out: 'static>(pub Arc<ClientManager<Out>>, pub Vec<Function<'lua>>)
|
||||
where
|
||||
Out: From<ClientMgrMessage> + Send;
|
||||
|
||||
impl<Out: 'static> LuaUserData for ClientManagerLua<Out>
|
||||
impl<Out: 'static> LuaUserData for ClientManagerLua<'_, Out>
|
||||
where
|
||||
Out: From<ClientMgrMessage> + Clone + Send
|
||||
{
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ impl LuaUserData for ServerLua {
|
|||
fn add_fields<'lua, F: UserDataFields<'lua, Self>>(fields: &mut F) {
|
||||
fields.add_field_method_get("ClientManager", |lua,this| {
|
||||
println!("Getting count");
|
||||
Ok(ClientManagerLua(this.0.client_manager.clone()))
|
||||
Ok(ClientManagerLua(this.0.client_manager.clone(), vec![]))
|
||||
});
|
||||
fields.add_field_method_get("NetworkManager", |lua,this| {
|
||||
Ok("unimplemented")
|
||||
|
|
|
|||
Loading…
Reference in New Issue