Code
function fixconsole(string)
local fix_str
local fix_len = string.len(string)
local ascii_byte
local lock_fix
for i=1, fix_len, 1 do
ascii_byte = string.byte(string,i)
if (ascii_byte == 168 and lock_fix == 0) then
ascii_byte = ascii_byte + 72
lock_fix = 1
end
if (ascii_byte == 184 and lock_fix == 0) then
ascii_byte = ascii_byte + 57
lock_fix = 1
end
if (ascii_byte > 191 and ascii_byte < 240 and lock_fix == 0) then
ascii_byte = ascii_byte - 64
lock_fix = 1
end
if (ascii_byte > 239 and ascii_byte < 256 and lock_fix == 0) then
ascii_byte = ascii_byte - 16
lock_fix = 1
end
lock_fix = 0
if (i == 1) then
fix_str = string.format("%s",string.char(ascii_byte))
end
if (i > 1) then
fix_str = string.format("%s%s",fix_str,string.char(ascii_byte))
end
end
return fix_str
end
-- возвращает фиксированную строку Пример использования:
Code
local test = "* фиксируй меня! *"
outputDebugString("Fixed string: "..fixconsole(test))
получим в консоли: Fixed string: * фиксируй меня! * http://gtascript.ru/forum/