Skip to content

Commit

Permalink
Merge pull request #115 from adrianocastro189/release/version-1.10.0
Browse files Browse the repository at this point in the history
Release - v1.10.0
  • Loading branch information
adrianocastro189 authored Jul 26, 2024
2 parents 5d9445f + 3fb8a5b commit 466d49d
Show file tree
Hide file tree
Showing 37 changed files with 223 additions and 102 deletions.
10 changes: 8 additions & 2 deletions documentation/docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ sidebar_position: 2

# Changelog

## 2024.07.26 - version 1.10.0

* Allow [dot notation keys](resources/support/arr#dot-notation-keys) to also
contain numbers when retrieving values from tables
* Remove the Output:say() method due to revisions in the SendChatMessage API

## 2024.07.19 - version 1.9.0

* A complete rewrite of the Window class content management to introduce
Expand All @@ -21,8 +27,8 @@ and [Inventory](resources/models/inventory#the-outdated-flag) models
to indicate that their items lists are outdated and need to be refreshed
* New [Interval class](resources/support/interval) to execute callback
functions at a specified interval in seconds
* New [Output method](resources/core/output#chat-methods) to make the
player say something in the chat frame
* ~New Output method to make the player say something in the chat frame~
(removed in v1.10.0)
* New [view constants file](resources/views/constants) to store values that
can be reused in multiple view classes and instances

Expand Down
19 changes: 15 additions & 4 deletions documentation/docs/resources/core/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,20 @@ local myTable = { key = 'value' }
library:dd(myTable)
```

## Chat methods
## ~Chat methods~

The output structure has also a facade to the chat methods that can be used
to print messages in the chat frame.
:::warning Deprecated

* `say(message)` - Makes the player say something in the chat frame.
Due to updates to the `SendChatMessage` API, the chat methods in the output
structure were removed in version 1.10.0.

This section is kept for historical purposes only and will be removed in
upcoming versions.

:::

~The output structure has also a facade to the chat methods that can be used
to print messages in the chat frame.~

* ~`say(message)` - Makes the player say something in the chat frame~
* ~`yell(message)` - Makes the player yell something in the chat frame~
41 changes: 41 additions & 0 deletions documentation/docs/resources/support/arr.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,47 @@ The code above is the same as doing `list['root']['level1-b']['level2']`,
however, if `root` or `level1-b` are `nil`, they'll be created as `{}` until
reaching the last key.

:::warning Careful with dot notation keys containing numbers

When retrieving values from a table using dot notation keys, it's possible to
use numbers as keys. Methods like `Arr:get()` and `Arr:hasKey()` plus others
that don't set values, will be able to return a value whether the key is a
number or a string.

As an example, calling `Arr:get()` with the following tables...

```lua
local listA = {['a'] = {['1'] = 'value'}}
local listB = {['a'] = {'value'}}
```

...will return the same value when passing `'a.1'` as the key.

**However**, when setting values with `Arr:set()`, the keys will always be
considered a string. So when calling `Arr:set(list, 'a.1', 'value')`, the
result will be:

```lua
local list = {['a'] = {['1'] = 'value'}}
```

That's the behavior adopted to avoid questions about the type of the keys,
considering that when retrieving, the library can check both types and return
the value, but when setting, it's not possible to imagine what's the intention
of the developer.

As a final note, for edge cases where a table contains both a string and the
same number as keys, `Arr:get()` will return the value of the string key.

```lua
local list = {['a'] = {'another-value', ['1'] = 'value'}}

-- return will be 'value'
Arr:get(list, 'a.1')
```

:::

## Creating constants

Lua doesn't have a native way to create constants, but it's possible to
Expand Down
8 changes: 4 additions & 4 deletions documentation/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ const config = {
{
title: 'Addons',
items: [
{
label: 'Center Gossip Frame',
href: 'https://www.curseforge.com/wow/addons/center-gossip-frame',
},
{
label: 'Memory',
href: 'https://www.curseforge.com/wow/addons/memory',
Expand All @@ -128,10 +132,6 @@ const config = {
label: 'MultiTargets',
href: 'https://www.curseforge.com/wow/addons/multitargets',
},
{
label: 'OMG! My Chicken is amazing!',
href: 'https://www.curseforge.com/wow/addons/omg-my-chicken-is-amazing',
},
],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ <h3>Parameters:</h3>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
2 changes: 1 addition & 1 deletion documentation/static/lua-docs/classes/Core.Events.html
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
30 changes: 1 addition & 29 deletions documentation/static/lua-docs/classes/Core.Output.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ <h2><a href="#Methods">Methods</a></h2>
<td class="name" nowrap><a href="#core.output:printed">core.output:printed (message)</a></td>
<td class="summary">Determines whether a message was printed in the output structure with
the out() method.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#core.output:say">core.output:say (message)</a></td>
<td class="summary">Sends a chat message which is equal to use /s in the game.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#core.output:setTestingMode">core.output:setTestingMode ()</a></td>
Expand Down Expand Up @@ -331,30 +327,6 @@ <h3>Returns:</h3>



</dd>
<dt>
<a name = "core.output:say"></a>
<strong>core.output:say (message)</strong>
</dt>
<dd>
Sends a chat message which is equal to use /s in the game.
<p> In other words, when called, this method will make the character say the
message in the chat.



<h3>Parameters:</h3>
<ul>
<li><span class="parameter">message</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.4">string</a></span>
The message to be said
</li>
</ul>





</dd>
<dt>
<a name = "core.output:setTestingMode"></a>
Expand Down Expand Up @@ -396,7 +368,7 @@ <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
2 changes: 1 addition & 1 deletion documentation/static/lua-docs/classes/Core.Target.html
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
2 changes: 1 addition & 1 deletion documentation/static/lua-docs/classes/Models.Item.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
2 changes: 1 addition & 1 deletion documentation/static/lua-docs/classes/Models.Macro.html
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ <h3>Parameters:</h3>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
2 changes: 1 addition & 1 deletion documentation/static/lua-docs/classes/Models.Player.html
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ <h3>Returns:</h3>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
2 changes: 1 addition & 1 deletion documentation/static/lua-docs/classes/Models.Realm.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
44 changes: 43 additions & 1 deletion documentation/static/lua-docs/classes/Support.Arr.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ <h2><a href="#Methods">Methods</a></h2>
<tr>
<td class="name" nowrap><a href="#support.arr:remove">support.arr:remove (list, value)</a></td>
<td class="summary">Removes a value from an indexed array.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#support.arr:safeGet">support.arr:safeGet (list, key)</a></td>
<td class="summary">Safe get is an internal method, not meant to be used by other classes
that will return a value from a list given a key that can be a string
or a number.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#support.arr:set">support.arr:set (list, key, value)</a></td>
Expand Down Expand Up @@ -741,6 +747,42 @@ <h3>Usage:</h3>
<span class="comment">-- list = {1, 3}, removed = true</span></pre>
</ul>

</dd>
<dt>
<a name = "support.arr:safeGet"></a>
<strong>support.arr:safeGet (list, key)</strong>
</dt>
<dd>
Safe get is an internal method, not meant to be used by other classes
that will return a value from a list given a key that can be a string
or a number.
<p> This method is a helper to allow dot notation keys to contain numbers,
which was a limitation of the get() method until version 1.10.0.



<h3>Parameters:</h3>
<ul>
<li><span class="parameter">list</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.6">table</a></span>
the table to have the value retrieved
</li>
<li><span class="parameter">key</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.4">string</a> or <span class="type">number</span></span>
the key to be used in the search
</li>
</ul>

<h3>Returns:</h3>
<ol>

<span class="types"><span class="type">any</span> or <span class="type">nil</span></span>
the value found in the list
</ol>




</dd>
<dt>
<a name = "support.arr:set"></a>
Expand Down Expand Up @@ -872,7 +914,7 @@ <h3>Usage:</h3>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-07-19 14:29:33 </i>
<i style="float:right;">Last updated 2024-07-26 14:41:08 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
Loading

0 comments on commit 466d49d

Please sign in to comment.