party: SetRaidTarget's third argument is a flag, not the word "local"
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SgstFWtn1RxEJ5kVrpgYwn
This commit is contained in:
@@ -501,14 +501,20 @@ pub(super) fn install(lua: &Lua) -> mlua::Result<()> {
|
|||||||
Ok(())
|
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
|
// 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`.
|
// `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(
|
g.set(
|
||||||
"SetRaidTarget",
|
"SetRaidTarget",
|
||||||
lua.create_function(|lua, (unit, index, local): (String, u8, Option<String>)| {
|
lua.create_function(|lua, (unit, index, local): (String, u8, Value)| {
|
||||||
let mut model = lua.app_data_mut::<Model>().expect("model app_data");
|
let mut model = lua.app_data_mut::<Model>().expect("model app_data");
|
||||||
let local = local.as_deref() == Some("local");
|
let local = !matches!(local, Value::Nil | Value::Boolean(false));
|
||||||
model
|
model
|
||||||
.party_requests
|
.party_requests
|
||||||
.push(PartyRequest::SetRaidTarget { unit, index, local });
|
.push(PartyRequest::SetRaidTarget { unit, index, local });
|
||||||
|
|||||||
Reference in New Issue
Block a user