Skip to content

Commit

Permalink
BugFix: correct fore/back ground being swapped in setTextFormat (Opti…
Browse files Browse the repository at this point in the history
…on B) (Mudlet#1481)

=========== ALTERNATIVE B: Correct error messages to match code ===========

The code reported errors in the arguments to the Lua function as per the
Wiki documentation at the time - but both were wrong in regard to how the
arguments were actually used.

This will not break things for people who have already found out that the
documentation was wrong and have ignored the discrepancies but it does
fix the error messages to reflect how the code actually works.

The Wiki will need to be revised - possibly with an explanation of defect
in older version help texts.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
  • Loading branch information
SlySven authored and vadi2 committed Dec 23, 2017
1 parent b015271 commit d7516bf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/TLuaInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3229,10 +3229,10 @@ int TLuaInterpreter::setTextFormat(lua_State* L)
windowName = QString::fromUtf8(lua_tostring(L, s));
}

QVector<int> colorComponents(6); // 0-2 RGB foreground, 3-5 RGB background
QVector<int> colorComponents(6); // 0-2 RGB background, 3-5 RGB foreground
if (!lua_isnumber(L, ++s)) {
lua_pushfstring(L,
"setTextFormat: bad argument #%d type (red foreground color component as number\n"
"setTextFormat: bad argument #%d type (red background color component as number\n"
"expected, got %s!)",
s,
luaL_typename(L, s));
Expand All @@ -3244,7 +3244,7 @@ int TLuaInterpreter::setTextFormat(lua_State* L)

if (!lua_isnumber(L, ++s)) {
lua_pushfstring(L,
"setTextFormat: bad argument #%d type (green foreground color component as number\n"
"setTextFormat: bad argument #%d type (green background color component as number\n"
"expected, got %s!)",
s,
luaL_typename(L, s));
Expand All @@ -3256,7 +3256,7 @@ int TLuaInterpreter::setTextFormat(lua_State* L)

if (!lua_isnumber(L, ++s)) {
lua_pushfstring(L,
"setTextFormat: bad argument #%d type (blue foreground color component as number\n"
"setTextFormat: bad argument #%d type (blue background color component as number\n"
"expected, got %s!)",
s,
luaL_typename(L, s));
Expand All @@ -3268,7 +3268,7 @@ int TLuaInterpreter::setTextFormat(lua_State* L)

if (!lua_isnumber(L, ++s)) {
lua_pushfstring(L,
"setTextFormat: bad argument #%d type (red background color component as number\n"
"setTextFormat: bad argument #%d type (red foreground color component as number\n"
"expected, got %s!)",
s,
luaL_typename(L, s));
Expand All @@ -3280,7 +3280,7 @@ int TLuaInterpreter::setTextFormat(lua_State* L)

if (!lua_isnumber(L, ++s)) {
lua_pushfstring(L,
"setTextFormat: bad argument #%d type (green background color component as number\n"
"setTextFormat: bad argument #%d type (green foreground color component as number\n"
"expected, got %s!)",
s,
luaL_typename(L, s));
Expand All @@ -3292,7 +3292,7 @@ int TLuaInterpreter::setTextFormat(lua_State* L)

if (!lua_isnumber(L, ++s)) {
lua_pushfstring(L,
"setTextFormat: bad argument #%d type (blue background color component as number\n"
"setTextFormat: bad argument #%d type (blue foreground color component as number\n"
"expected, got %s!)",
s,
luaL_typename(L, s));
Expand Down

0 comments on commit d7516bf

Please sign in to comment.