blob: 6fc53e2a96a4e08a8fc15a9588f10205520139eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
<html>
<head>
<title>
Emscripten: Lua
</title>
<script src="lua.js"></script>
<script>
// print function which the Lua engine will call
function print(text) {
document.getElementById('output').innerHTML += text + '<br>';
printed = true;
}
function execute(text) {
printed = false;
raw_argv[8] = Pointer_make(intArrayFromString(text), 0, ALLOC_STATIC); // leak!
argv = Pointer_make(raw_argv, null);
__Z7runargsP9lua_StatePPci(GLOBAL_L, argv, argc)
if (!printed) {
print('<small><i>(no output)</i></small>');
}
}
function doRun() {
args = ['-e', ''];
run(args);
}
</script>
</head>
<body onload="doRun(); document.getElementById('the_input').focus()">
<p>
This is the <a href="http://www.lua.org/">Lua</a> interpreter, compiled from C to JavaScript using <a href="http://emscripten.org">Emscripten</a>,
running in your browser (without any plugins).
</p>
<p>
<ul>
<li>Most stuff should work, please report bugs if you find them!</li>
<li>Note that this is an unoptimized build (see <a href="http://code.google.com/p/emscripten/issues/detail?id=8">issue 8</a>)</li>
</ul>
</p>
<hr>
<!-- Call Lua's execution function -->
<form onsubmit="execute(the_input.value); the_input.value = ''; return false">
<b>Enter some Lua</b>:
<input type="text" id="the_input">
<input type="submit" value="execute">
</form>
<hr>
<div id="output" style="font-family: Courier New,Courier,monospace;"></div>
</body>
</html>
|