-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathlua.html
More file actions
40 lines (40 loc) · 1.32 KB
/
lua.html
File metadata and controls
40 lines (40 loc) · 1.32 KB
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>Plugins</title>
<style>
lua-script {
display: none;
}
</style>
<script type="importmap">
{ "imports": { "polyscript": "../../dist/index.js" } }
</script>
<script type="module">
import { define } from "polyscript";
define("lua", {
interpreter: "wasmoon",
hooks: {
main: {
async onReady(wasmoon, element) {
// Somehow this doesn't work in Wasmoon
wasmoon.io.stdout = (message) => {
console.log("🌑", wasmoon.type, message);
};
wasmoon.run(element.textContent);
element.replaceChildren("See console ->");
element.style.display = "block";
},
}
}
});
</script>
</head>
<body>
<lua-script lua-click="print(event.type)">
print('Hello Console!')
</lua-script>
</body>
</html>