OpenRA/OpenRA · error · LuaException
WAngle does not define a member '{key}'
Error message
WAngle does not define a member '{key}' What it means
Lua scripting error from the WAngle indexer getter. WAngle only exposes the `"Angle"` member to Lua scripts; any other key passed via `wangle[key]` hits the default case and throws a LuaException naming the unknown member.
Source
Thrown at OpenRA.Game/WAngle.cs:268
$"({left.WrappedClrType().Name}, {right.WrappedClrType().Name})");
}
public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right)
{
if (!left.TryGetClrValue(out WAngle a) || !right.TryGetClrValue(out WAngle b))
return false;
return a == b;
}
public LuaValue this[LuaRuntime runtime, LuaValue key]
{
get
{
switch (key.ToString())
{
case "Angle": return Angle;
default: throw new LuaException($"WAngle does not define a member '{key}'");
}
}
set => throw new LuaException("WAngle is read-only. Use Angle.New to create a new value");
}
public LuaValue ToString(LuaRuntime runtime) => ToString();
#endregion
}
}
View on GitHub (pinned to a520984d91)
Solutions
- Use the only valid member: `wangle.Angle`.
- Check the OpenRA scripting docs / WAngle.cs to confirm the exposed members before accessing.
- If you need a different representation, derive it from `wangle.Angle` yourself.
Example fix
-- before local d = wangle.Degrees -- after local d = wangle.Angle
Defensive patterns
Strategy: type-guard
Validate before calling
local valid = { Angle = true }
if valid[key] then
v = wangle.Angle
else
error("WAngle has no member " .. tostring(key))
end Try / catch
local ok, val = pcall(function() return wangle.Angle end) if ok then use(val) else reportUnknownMember(wangle, key) end
Prevention
- Only access `wangle.Angle`; check WAngle.cs for the canonical member list.
- Avoid guessing member names from other types' docs.
- Cache the member name as a constant to avoid typos.
When it happens
Trigger: A Lua expression like `wangle.Degrees`, `wangle.Radians`, or `wangle["foo"]` — any member access other than `wangle.Angle`.
Common situations: Scripts guessing member names (e.g. assuming `Degrees` exists) or copy-pasted from documentation for a different type. Also typos in the key string.
Related errors
- CPos does not define a member '{key}'
- CVec does not define a member '{key}'
- Attempted to call WAngle.Add(WAngle, WAngle) with invalid ar
- Attempted to call WAngle.Subtract(WAngle, WAngle) with inval
- WAngle is read-only. Use Angle.New to create a new value
AI-assisted analysis of OpenRA/OpenRA@a520984d91 (2026-08-13).
Data as JSON: /api/errors/d623daad03602acc.
Report an issue: GitHub.