tbl = {"function", "local", "if", "elseif", "else", "then", "end", "print", "math.random", "math.max"}
local text =
[[function test()
local x = 2
if x == 2 then
print(x)
math.random(1, 10)
math.max(2, 9, 1, 4)
end
end]]
addEventHandler("onClientRender", root,
function()
local color = "#FFFFFF"
for i,v in ipairs(tbl) do
if text:find(" "..v) or text:find(v.." ") then
if i > 0 and i <= 7 then
color = "#0000FF"
elseif i > 7 then
color = "#A6E22D"
end
text = text:gsub(v, color..v.."#FFFFFF")
end
end
dxDrawText(text, 15, sh/3,_,_,_, 2, "default-bold", "left", "top", false, false, false, true)
end)