From 7098d64203f988cc1d5457c7f040089808c67ad8 Mon Sep 17 00:00:00 2001 From: grom Date: Fri, 16 Oct 2026 17:36:35 -0600 Subject: [PATCH] party: SetRaidTarget's third argument is a flag, not the word "local" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SuperWoW's extra argument marks the icon local-only, and its callers disagree on how to spell it: the wiki writes `SetRaidTarget(unit, i, "local")`, while SoloRaidTargetIcons passes the boolean `IsSuperWoWLoaded() and not IsPlayerInPartyOrRaid()` (`main.lua:51`). Typing the parameter as a `String` raised on that boolean — "bad argument #3: error converting Lua boolean to String", five times in one session's log — and it raised *only while solo*, which is the one case that addon exists for. So marking a target outside a group did nothing at all. Lua truthiness takes both spellings, which is what a flag means in this language. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01SgstFWtn1RxEJ5kVrpgYwn --- crates/benilla-ui/src/script/party.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 });