Improve demo site (#990)

Updated builtins tables, made `` highlighted as a string, removed code
that replaced "stdin:" from print messages

Before:

![image](https://github.com/Roblox/luau/assets/120410318/ba399f0b-d612-4f69-a523-56369eafb037)
After:

![image](https://github.com/Roblox/luau/assets/120410318/98ab06c8-9b2a-4d9b-aa86-0a8432296417)

---------

Co-authored-by: Someone-dQw4w9WgXcQ <dcheunggb@outlook.com>
This commit is contained in:
Someon1e 2023-07-28 16:11:16 +01:00 committed by GitHub
parent f80229c517
commit 087be529b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 10 deletions

View File

@ -63,7 +63,7 @@
function output(text) {
var output_box = document.getElementById("output");
output_box.value += text.replace('stdin:', '') + "\n";
output_box.value += text + "\n";
// scroll to bottom
output_box.scrollTop = output_box.scrollHeight;
}

View File

@ -27,27 +27,24 @@
// long list of standard functions from lua manual
var builtins = wordRE([
"_G","_VERSION","assert","error","getfenv","getmetatable","ipairs","load", "loadstring","next","pairs","pcall",
"print","rawequal","rawget","rawset","require","select","setfenv","setmetatable","tonumber","tostring","type",
"print","rawequal","rawget","rawset","require","select","setfenv","setmetatable","tonumber","tostring","type","typeof",
"unpack","xpcall",
"coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield",
"debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable",
"debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable",
"debug.setupvalue","debug.traceback",
"debug.info","debug.traceback",
"math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg",
"math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max",
"math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh",
"math.sqrt","math.tan","math.tanh",
"os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale",
"os.time","os.tmpname",
"os.clock","os.date","os.difftime","os.time",
"string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub",
"string.byte","string.char","string.find","string.format","string.gmatch","string.gsub",
"string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper",
"table.concat","table.insert","table.maxn","table.remove","table.sort"
"table.concat","table.clone","table.create","table.freeze","table.isfrozen","table.insert","table.maxn","table.move","table.remove","table.sort","table.unpack"
]);
var keywords = wordRE(["and","break","elseif","false","nil","not","or","return",
"true","function", "end", "if", "then", "else", "do",
@ -72,7 +69,7 @@
stream.skipToEnd();
return "comment";
}
if (ch == "\"" || ch == "'")
if (ch == "\"" || ch == "'" || ch == "`")
return (state.cur = string(ch))(stream, state);
if (ch == "[" && /[\[=]/.test(stream.peek()))
return (state.cur = bracketed(readBracket(stream), "string"))(stream, state);