Minor fixes to Lua includes.

Originally committed to SVN as r1428.
This commit is contained in:
Niels Martin Hansen 2007-07-17 22:25:56 +00:00
parent 52904f6217
commit 42f47ed7eb
2 changed files with 3 additions and 3 deletions

View file

@ -34,7 +34,7 @@ module("unicode")
-- Return the number of bytes occupied by the character starting at the i'th byte in s
function charwidth(s, i)
local b = s:byte(i)
local b = s:byte(i or 1)
if not b then
--aegisub.debug.out(3, "unicode.charwidth of '%s' @ %d, nil byte\n", s, i)
-- FIXME, something in karaskel results in this case, shouldn't happen

View file

@ -107,13 +107,13 @@ end
-- Create an alpha override code from a style definition colour code
function alpha_from_style(scolor)
local r, g, b, a = extract_color(scolor)
return ass_alpha(a)
return ass_alpha(a or 0)
end
-- Create an colour override code from a style definition colour code
function color_from_style(scolor)
local r, g, b = extract_color(scolor)
return ass_color(r, g, b)
return ass_color(r or 0, g or 0, b or 0)
end
-- Converts HSV (Hue, Saturation, Value) to RGB