setExitStub incorrect error message on unknown direction type

Bug #1670245 reported by Vadim Peretokin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mudlet
Opinion
Low
Unassigned

Bug Description

Passing in 13 as a dirType causes a "setExitStub: Need a dir number as 2nd argument" error. The logic should instead follow the current Lua error message guidelines for reporting what the value is + say "setExitStub: dirType must be between 1 and 10".

Revision history for this message
Stephen Lyons (slysven) wrote :

This is probably caused by TLuaInterpreter::dirToNumber(...); this first tests the input argument first for being a string - however a number will always be able to be interpreted as a string so the code will then check for a match against all the direction texts before dropping through to the test for the input being a number - that too, will succeed but then the number 13 will be found to be out of range and the returned number will be set to be zero (error return value) which triggers the "setExitStub: Need a dir number as 2nd argument" error response.

A fix for this will need to take care that all uses of dirToNumber - currently: setExitStub(...), connectExitStub(...), lockExit(...), hasExitLock(...) and setExit(...) are not degraded by the modifications - IIRC there are other issues with one or two of these that may also need attention {connectExitStub(...) may also have issues in this area}.

Revision history for this message
Vadim Peretokin (vperetokin) wrote :

Migrating issues to Github, please follow the new discussion here: https://github.com/Mudlet/Mudlet/issues/586

This issue needs to be closed and there is no appropriate status, so will set it to "Opinion" just for migration purposes.

Changed in mudlet:
status: Confirmed → Opinion
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.