mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
37 lines
1.2 KiB
HTML
37 lines
1.2 KiB
HTML
<!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": { "@pyscript/core": "../../min.js" } }
|
|
</script>
|
|
<script type="module">
|
|
import { define } from "@pyscript/core";
|
|
define("lua", {
|
|
interpreter: "wasmoon",
|
|
async onRuntimeReady(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>
|