Post your best Lua script examples here

User avatar
By PuceBaboon
wouter011 wrote:Works flawlessly when using minicom for entering LUA. Still having some problems using tough.. Keep up the good work!

Wouter, make sure you quit minicom before trying to upload files with luatool, they
can't coexist on the same com.
User avatar
By gwizz
#7639 Just in case it helps anyone else - the standard port for MQTT is 1883 - see

Also I had to remove the / at the start of the topic to get it working.

EDIT - I now realise you don't have to remove the / - it's just part of the topic name if you use it.

So the send commands become:
Code: Select allmqtt:connect(1883,
mqtt:send("topic","Hello from example!",0,0, function(conn) print("sent") end)
Last edited by gwizz on Mon Jan 19, 2015 11:14 am, edited 1 time in total.
User avatar
By ampakinetic
#7644 I found it needed time between the commands for it to work with - ie running all the sample lines in one batch doesn't work, but running them one at a time subscribed to the topic successfully.