Post your best Lua script examples here

User avatar
By bernbout
#48961
xchip wrote:Hi guys,

Just a quick web IDE that I wrote to create, edit and run lua files on the MCUNode using a browser.

The script has been updated(again) with many bug fixes.

Any feedback is welcome.

Code: Select all--[[
XChip's NodeMCU IDE

Create, Edit and run NodeMCU files using your webbrowser.
Examples:
http://<mcu_ip>/ will list all the files in the MCU
http://<mcu_ip>/newfile.lua    displays the file on your browser
http://<mcu_ip>/newfile.lua?edit  allows to creates or edits the specified script in your browser
http://<mcu_ip>/newfile.lua?run   it will run the specified script and will show the returned value

]]--
....
....

I uploaded this code.
Code: Select all http://<mcu_ip>/ will list all the files in the MCU

This returns nothing, although there are files on my NodeMCU
Esplorer console shows GET

Code: Select all http://<mcu_ip>/Blink.lua    displays the file on your browser

This works fine and displays the contents of the file I ask for. So why doe it not list the files as above?
Esplorer console shows : GET Blink.lua

Code: Select allhttp://<mcu_ip>/newfile.lua?edit  allows to creates or edits the specified script in your browser

Again just a BLANK screen. Nothing.
Esplorer console shows : GET Blink.lua edit

Run works.
Esplorer shows: GET Blink.lua run
and the file actually runs.

So List files and Edit does not work, at least for me. I am running the latest version of NodeMCU 1.5.1 built by frightanic.com
Any suggestions?
User avatar
By pstehlik
#57187 I have fixed the original source code by XChip so it's working with up-to-date NodeMCU Lua now.
I have also cleaned it up a bit and implemented some useful new features: redirecting output to browser window, deleting files and creating new ones.

https://github.com/joysfera/nodemcu-web-ide