setExitStub incorrect error message on unknown direction type
Bug #1670245 reported by
Vadim Peretokin
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".
To post a comment you must log in.
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 {connectExitStu b(...) may also have issues in this area}.