Conversation
|
Hey there! Thanks for helping Mudlet improve. 🌟 Test versionsYou can directly test the changes here:
No need to install anything - just unzip and run. |
|
#4599 is good to go with me! |
|
https://github.com/Mudlet/Mudlet/pull/4599/files#diff-b18b3569a103eae2a957cb82ab2867736fbfe1762639b3a300869a027191550bL7959 forgot that PR covers it already, my bad. |
|
Actually your type changes are not covered there, so this still has merit. 😉 |
|
Want to merge your PR first? Otherwise I'll give you a conflict 😢 |
| type = type.toLower(); | ||
| if (type == "timer") { | ||
| if (type == QLatin1String("timer")) { | ||
| cnt += host.getTimerUnit()->mLookupTable.count(name); |
There was a problem hiding this comment.
The use of += is deceptive here - as only ONE of the specified types will be checked it is probably clearer to only use = in these assignments...
| } else if (type == "script") { | ||
| } else if (type == QLatin1String("script")) { | ||
| cnt += host.getScriptUnit()->findScriptId(name).size(); | ||
| } |
There was a problem hiding this comment.
Should we not be producing a nil + error message about a non-valid type being provided? And if we do THAT then it makes more sense for each type to be refactored to the form of:
- } else if (type == QLatin1String("button")) {
- cnt += host.getActionUnit()->findActionsByName(name).size();
- } else if (type == "script") {
+ if (type == QLatin1String("button")) {
+ lua_pushnumber(L, host.getActionUnit()->findActionsByName(name).size());
+ return 1
+ }
- } else if (type == "script") {
+ if (type == "script") {|
|
||
| Host& host = getHostFromLua(L); | ||
| int cnt = 0; | ||
| type = type.toLower(); |
There was a problem hiding this comment.
This could be done as part of (new) line 7962 could it not?
SlySven
left a comment
There was a problem hiding this comment.
👍 but I think we can also handle the run-time error of an invalid (or even empty) second argument...
Thanks, done! |
Brief overview of PR changes/additions
Modernize exists() function
Motivation for adding to Mudlet
Better error messages
Other info (issues closed, discussion etc)