|
16 | 16 | ---@class mods.Set<T>:{[T]:true} |
17 | 17 | ---@operator add(mods.Set):mods.Set |
18 | 18 | ---@operator band(mods.Set):mods.Set |
| 19 | +---@operator bor(mods.Set):mods.Set |
19 | 20 | ---@operator bxor(mods.Set):mods.Set |
20 | 21 | ---@operator sub(mods.Set):mods.Set |
21 | 22 | ---@overload fun(t?:any[]|mods.Set|mods.List):mods.Set |
@@ -213,8 +214,8 @@ function Set:symmetric_difference(set) end |
213 | 214 | --- |
214 | 215 | ---> [!NOTE] |
215 | 216 | ---> |
216 | | ----> `union` is also available as the `__add` (`+`) operator. |
217 | | ----> `a:union(b)` is equivalent to `a + b`. |
| 217 | +---> `union` is available as `__add` (`+`) and `__bor` (`|`) on Lua 5.3+. |
| 218 | +---> `a:union(b)` is equivalent to `a + b` and `a | b`. |
218 | 219 | --- |
219 | 220 | ---@param self mods.Set|table<any,true> |
220 | 221 | ---@param set mods.Set|table<any,true> |
@@ -393,6 +394,24 @@ function Set:values() end |
393 | 394 | ---@return mods.Set |
394 | 395 | function Set.__add(self, set) end |
395 | 396 |
|
| 397 | +--- |
| 398 | +---Return the union of two sets using `|`. |
| 399 | +--- |
| 400 | +---```lua |
| 401 | +---a = Set({ "a", "b" }) |
| 402 | +---b = Set({ "b", "c" }) |
| 403 | +---u = a | b --> { a = true, b = true, c = true } |
| 404 | +---``` |
| 405 | +--- |
| 406 | +---> [!NOTE] |
| 407 | +---> |
| 408 | +---> `__bor` is the operator form of `:union(set)` on Lua 5.3+. |
| 409 | +--- |
| 410 | +---@param self mods.Set|table<any,true> |
| 411 | +---@param set mods.Set|table<any,true> |
| 412 | +---@return mods.Set |
| 413 | +function Set.__bor(self, set) end |
| 414 | + |
396 | 415 | --- |
397 | 416 | ---Return the intersection of two sets using `&`. |
398 | 417 | --- |
|
0 commit comments