diff --git a/crates/benilla-ui/src/script/party.rs b/crates/benilla-ui/src/script/party.rs index c49f065e..198b9a21 100644 --- a/crates/benilla-ui/src/script/party.rs +++ b/crates/benilla-ui/src/script/party.rs @@ -501,14 +501,20 @@ pub(super) fn install(lua: &Lua) -> mlua::Result<()> { Ok(()) })?, )?; - // SetRaidTarget(unit, index [, "local"]) is the engine verb. `SetRaidTargetIcon` is + // SetRaidTarget(unit, index [, local]) is the engine verb. `SetRaidTargetIcon` is // FrameXML's toggle around it (`TargetFrame.lua:486`), and `TargetFrame.lua:488`, `:490` and // `Bindings.xml:1160` call it bare. SuperWoW's third argument, see `PartyRequest::SetRaidTarget`. + // + // That argument is a **flag**, taken by Lua truthiness, and the callers disagree on how to + // spell it: SuperWoW's own wiki writes `"local"`, while SoloRaidTargetIcons passes the + // boolean `IsSuperWoWLoaded() and not IsPlayerInPartyOrRaid()` (`main.lua:51`). Typing the + // parameter as a `String` raised on that boolean — and only ever while solo, which is the + // one case the addon exists for, so marking a target out of a group did nothing at all. g.set( "SetRaidTarget", - lua.create_function(|lua, (unit, index, local): (String, u8, Option)| { + lua.create_function(|lua, (unit, index, local): (String, u8, Value)| { let mut model = lua.app_data_mut::().expect("model app_data"); - let local = local.as_deref() == Some("local"); + let local = !matches!(local, Value::Nil | Value::Boolean(false)); model .party_requests .push(PartyRequest::SetRaidTarget { unit, index, local });