mudlet-makers team mailing list archive
-
mudlet-makers team
-
Mailing list archive
-
Message #01427
Re: [Bug 683431] [NEW] Possile getFgColor causes crash
Thanks for the report. I'll add a check for valid selection to
getFgColor().
As a work around, use the return value of selectString() to make sure
that a valid selection has been possible. Using functions that expect a
valid text selection leads to undefined behaviour. If I remember
correctly selectString() returns -1 on errors.
In any case your script has a *very* poor performance. Why do you want
to keep track of the first color of each line while ignoring any other
colors?
For a much faster and more powerful method look into using named buffers
(-> createBuffer()) to store or manipulate the line + color information.
The result will be tons faster because the low level string performance
of Lua is very poor compared to C++.
Heiko
On 12/01/2010 12:28 AM, G Isherwood wrote:
> Public bug reported:
>
> On the sign-in screen to Achaea (and when sending a message in game)
> Mudlet crashes. For each line I am extracting the foreground colour with
> getFgColor, then storing the line/deleting from screen. If i comment out
> the getFgColor, everything works (though without colour obviously).
>
> --Copy Lines and Foreground Colour
> function Store_Lines()
> local r
> local g
> local b
>
> --select/copy colour/store to table
> selectString(matches[2],1)
> r,g,b = getFgColor()
>
> --Store to table
> if r and g and b and matches[2] then
> table.insert(Main_Lines, {raw_line = matches[2], red = r, green = g, blue = b, prefix = false, suffix = false, args = false})
> elseif matches[2] then
> table.insert(Main_Lines, {raw_line = matches[2], red = false, green = false, blue = false, prefix = false, suffix = false, args = false})
> end
>
> --Hide Line
> deleteLine()
> end
>
> Windows 7 Pro, Mudlet 1.2-pre6
>
> ** Affects: mudlet
> Importance: Undecided
> Status: New
>
>
--
Possile getFgColor causes crash
https://bugs.launchpad.net/bugs/683431
You received this bug notification because you are a member of Mudlet
Makers, which is subscribed to Mudlet.
Status in Mudlet the MUD client: New
Bug description:
On the sign-in screen to Achaea (and when sending a message in game) Mudlet crashes. For each line I am extracting the foreground colour with getFgColor, then storing the line/deleting from screen. If i comment out the getFgColor, everything works (though without colour obviously).
--Copy Lines and Foreground Colour
function Store_Lines()
local r
local g
local b
--select/copy colour/store to table
selectString(matches[2],1)
r,g,b = getFgColor()
--Store to table
if r and g and b and matches[2] then
table.insert(Main_Lines, {raw_line = matches[2], red = r, green = g, blue = b, prefix = false, suffix = false, args = false})
elseif matches[2] then
table.insert(Main_Lines, {raw_line = matches[2], red = false, green = false, blue = false, prefix = false, suffix = false, args = false})
end
--Hide Line
deleteLine()
end
Windows 7 Pro, Mudlet 1.2-pre6
References