Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
86 lines (75 loc) · 2.43 KB

File metadata and controls

86 lines (75 loc) · 2.43 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<html>
<head>
<title>
Emscripten: Lua
</title>
<link id="bespin_base" href="skywriter/"/>
<script src="skywriter/BespinEmbedded.js"></script>
<style type="text/css">
.bespin {
width: 80%;
height: 30%;
}
</style>
<script src="lua.js"></script>
<script>
// print function which the Lua engine will call
var lines = [], printed = false;
function print(text) {
lines.push(text);
printed = true;
}
function execute(text) {
lines = [];
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>');
}
var element = document.getElementById('output');
if (!element) return; // perhaps during startup
element.innerHTML = lines.join('<br>') + '<hr>' + element.innerHTML;
}
var editor;
function doRun() {
args = ['-e', ''];
run(args);
setTimeout(function() {
if (!bespin.useBespin) setTimeout(arguments.callee, 10);
bespin.useBespin(document.getElementById('the_input'), { "stealFocus":true, "syntax": "lua" }).then(function(env) {
editor = env.editor;
});
}, 10);
}
</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>
<li>The editor is <a href="https://mozillalabs.com/skywriter/">Skywriter</a>. Would be cool if someone made a syntax highlighting plugin for Lua...
</ul>
</p>
<hr>
<!-- Call Lua's execution function -->
<form onsubmit="execute(editor.value); return false">
<b>Enter some Lua</b>:
<input type="submit" value="execute">
<div id="the_input">
print("Hello world! This is: " .. _VERSION);
for i=1,5 do
print("A number: " .. i)
end
</div>
</form>
<hr>
<div id="output" style="font-family: Courier New,Courier,monospace;"></div>
</body>
</html>
Morty Proxy This is a proxified and sanitized view of the page, visit original site.