(_: lua::Context<'gc>, value: lua::Value<'gc>)
| 19 | |
| 20 | impl<'gc> FromValue<'gc> for ModFlags { |
| 21 | fn from_value(_: lua::Context<'gc>, value: lua::Value<'gc>) -> Result<Self, lua::TypeError> { |
| 22 | match value { |
| 23 | lua::Value::Table(mods) => { |
| 24 | let mut r = Self::empty(); |
| 25 | |
| 26 | for (_, v) in mods { |
| 27 | match v { |
| 28 | lua::Value::UserData(ud) => { |
| 29 | let bits = *ud.downcast_static::<Self>().map_err(|_| { |
| 30 | lua::TypeError { expected: "Mod", found: value.type_name() } |
| 31 | })?; |
| 32 | |
| 33 | r |= bits; |
| 34 | } |
| 35 | _ => { |
| 36 | return Err(lua::TypeError { expected: "Mod", found: v.type_name() }); |
| 37 | } |
| 38 | }; |
| 39 | } |
| 40 | |
| 41 | return Ok(r); |
| 42 | } |
| 43 | _ => Err(lua::TypeError { found: value.type_name(), expected: "table" }), |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | pub fn module<'gc>( |
nothing calls this directly
no outgoing calls
no test coverage detected