Module:ScriptItem: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 342: Line 342:
local entries = p.getIndexedArgs(frame, 'description')
local entries = p.getIndexedArgs(frame, 'description')
local startTextFirstLine = "The <span style=\"font-family: 'Source Code Pro', monospace;\">"..p.getDisplayedName(frame).."</span> "..args.type.." is "..(args.type == "event" and "invoked when" or "used to").." "
local startTextFirstLine = "The <span style=\"font-family: 'Source Code Pro', monospace;\">"..p.getDisplayedNameColoured(frame).."</span> "..args.type.." is "..(args.type == "event" and "invoked when" or "used to").." "
for i,entry in ipairs(entries) do
for i,entry in ipairs(entries) do
Line 771: Line 771:
else
else
return args.name
return args.name
end
end
function p.getDisplayedNameColoured(frame)
local typeRgb = '#009106';
local nameRgb = '#0645ad';
local args = p.getArgs(frame)
if p.isOOP(frame) then
return "<span style='color:#"..typeRgb..";'>"..args.class:lower().."</span>.<span style='color:"..nameRgb.."';>"..args.name.."</span>"
else
return "<span style='color:"..nameRgb.."';>"..args.name.."</span>"
end
end
end
end
Line 834: Line 845:
local out = {}
local out = {}
local line1 = "The <span style=\"font-family: 'Source Code Pro', monospace;\">"..p.getDisplayedName(frame).."</span> "..args.type.." is used "
local line1 = "The <span style=\"font-family: 'Source Code Pro', monospace;\">"..p.getDisplayedNameColoured(frame).."</span> "..args.type.." is used "
if args.type == 'variable' or args.type == 'function' then
if args.type == 'variable' or args.type == 'function' then
line1 = line1.."globally."
line1 = line1.."globally."
Line 897: Line 908:
text1 = 'Methods use the dot "." operator in JS and Squirrel, or the colon operator ":" in Lua.'
text1 = 'Methods use the dot "." operator in JS and Squirrel, or the colon operator ":" in Lua.'
end
end
rows[1] = { "<span style=\"font-family: 'Source Code Pro', monospace;\">"..p.properCase(parts[1]).."</span>", "Object", "Userdata type in Lua and Squirrel, or Object type in JS." }
rows[1] = { "<span style=\"font-family: 'Source Code Pro', monospace;\">"..parts[1].."</span>", "Object", "Userdata type in Lua and Squirrel, or Object type in JS." }
rows[2] = { "<span style=\"font-family: 'Source Code Pro', monospace;\">"..parts[2].."</span>", p.properCase(args.type), text1 }
rows[2] = { "<span style=\"font-family: 'Source Code Pro', monospace;\">"..parts[2].."</span>", p.properCase(args.type), text1 }
end
end
6,833

edits