This project was bootstrapped with Create React App.
After that, I installed fengari and fengari-interop
yarn add fengari-lua/fengari fengari-lua/fengari-interop
That command installs fengari and fengari-interop directly from the github repo, not from npm packages (the libs ain't published at the npm official repo). That means that the installation gets tied to a specific commitish in their git repo (the latest in the main branch at the time of issuing the add/install command). They promise there should be a npm package published (sometime).
To run this webapp use:
Just the first time:
yarn install
Every time:
yarn start
fengari-web
is a tool to use<script>
tags embeded with lua code. That tool initsfengari
andfengari-interop
loads a single lua vm for the whole web and you ain't got control over it. That's the reason why I 'm not using it. Despite being on web I prefer to initfengari
andfengari-interop
myself so I got control on the loaded code and vm.- Although it should be possible I 'm not testing calling a JS function from LUA code (it should b e possible using fengari-interop) I 'm just testing calling a LUA function from JS (the function is in fact defined by lua code in the global/window context). The example was taken from a fengari-interop github issue (docs are not abundant)