Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infrastructure: Editorial fixes to a few Lua API error messages #6871

Merged
merged 1 commit into from Jun 4, 2023

Conversation

vadi2
Copy link
Member

@vadi2 vadi2 commented May 27, 2023

Brief overview of PR changes/additions

Editorial fixes to a few Lua API error messages: lowercase after the function name : and no period at the end of the message.

Motivation for adding to Mudlet

Consistency and professionalism

Other info (issues closed, discussion etc)

@vadi2 vadi2 requested review from a team as code owners May 27, 2023 16:26
@add-deployment-links
Copy link

add-deployment-links bot commented May 27, 2023

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

@@ -2598,7 +2598,7 @@ int TLuaInterpreter::setExitStub(lua_State* L)
}
TRoom* pR = host.mpMap->mpRoomDB->getRoom(roomId);
if (!pR) {
lua_pushstring(L, "setExitStub: RoomId doesn't exist");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems strange that we are not reporting the value that roomId was given! Tthough if we fix this so it does, we should report the original argument passed as the first argument and NOT what getVerifiedInt(...) returned.

Copy link
Member Author

@vadi2 vadi2 May 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not clear, why not?

Copy link
Member

@SlySven SlySven May 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the "number" that the user entered might not exactly be an "integer" like wot we wuz expecting, or could contain extra things (like commas that are not parsed as the user might expect) e.g. 1,200 is handled not as 1200 but as 1 and 10.6 is handled as 10 not 10.6 or 11, conversely 1.23e2 is processed as 123 but if there is a problem that is the value that will be shown and not what the user entered.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we do it like this anywhere else in the API... has this been a problem that has been affecting people a lot?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I started doing it like that for one of my PRs recently, ah yeah, it was #6401 where I added TLuaInterpreter::getVerifiedStringOrInteger(...) which uses lua_tonumber(...) but then applies qRound(...) to convert the double the lua function returns into an integer (and avoid using lua_tointeger(...) because {IIRC} on Windows lua_tointeger(...) returns a long int that may not fit into an int on that platform which the built-in Qt code analyser moans about...!) As such, when then reporting an issue with the argument supplied it has to refer to the passed value rather than what it might have gotten mangled to...!

😀

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this addressing a real problem people have been running into though?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I will skip doing this change, I was just looking to do a simple fix and there is a lot of other higher priority things to be working on.

@vadi2 vadi2 self-assigned this May 30, 2023
@vadi2 vadi2 merged commit abdd27f into development Jun 4, 2023
9 checks passed
@vadi2 vadi2 deleted the lua-api-editorial-fixes branch June 4, 2023 10:32
vadi2 added a commit to vadi2/Mudlet that referenced this pull request Dec 24, 2023
…et#6871)

<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Editorial fixes to a few Lua API error messages: lowercase after the
function name `:` and no period at the end of the message.
#### Motivation for adding to Mudlet
Consistency and professionalism
#### Other info (issues closed, discussion etc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants