mirror of
https://github.com/hexedtech/codemp.git
synced 2024-12-22 21:04:53 +01:00
fix(lua): event type field
This commit is contained in:
parent
7d212c6f10
commit
13ef05f8a2
2 changed files with 7 additions and 3 deletions
1
.github/workflows/lua.yml
vendored
1
.github/workflows/lua.yml
vendored
|
@ -3,6 +3,7 @@ name: lua
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
- stable
|
||||
|
||||
permissions:
|
||||
|
|
|
@ -304,11 +304,14 @@ impl LuaUserData for CodempEvent {
|
|||
fn add_fields<F: LuaUserDataFields<Self>>(fields: &mut F) {
|
||||
fields.add_field_method_get("type", |_, this| match this {
|
||||
CodempEvent::FileTreeUpdated(_) => Ok("filetree"),
|
||||
CodempEvent::UserJoin(_) | CodempEvent::UserLeave(_) => Ok("user"),
|
||||
CodempEvent::UserJoin(_) => Ok("join"),
|
||||
CodempEvent::UserLeave(_) => Ok("leave"),
|
||||
});
|
||||
fields.add_field_method_get("value", |_, this| match this {
|
||||
CodempEvent::FileTreeUpdated(x) => Ok(x.clone()),
|
||||
CodempEvent::UserJoin(x) | CodempEvent::UserLeave(x) => Ok(x.clone()),
|
||||
CodempEvent::FileTreeUpdated(x)
|
||||
| CodempEvent::UserJoin(x)
|
||||
| CodempEvent::UserLeave(x)
|
||||
=> Ok(x.clone()),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue