Reputation: 1273
Is there some JS library that could execute script written in some other scripting language (like Lua) in a browser environment. E.g. something like this.
TheLibabry.executeScript(scriptCode, apiObjects, timeout);
I know about eval() function, but I need a script to run in isolated environment i.e. do not have access to my code. And I want some simple, classic imperative language like Lua or even basic. Also, I want to be able to set a timeout for this script. I.e. limit execution time.
Upvotes: 1
Views: 305
Reputation: 3452
You could try leveraging WebAssembly to run different code languages.
Wasm Lua
https://github.com/vvanders/wasm_lua
Docs for web assembly
https://developer.mozilla.org/en-US/docs/WebAssembly
Available langs in Web Assembly
https://github.com/appcypher/awesome-wasm-langs
Upvotes: 3