Post your best Lua script examples here

User avatar
By iburak
#47925 Hi everyone
I am trying to get RSSI and get IP form AP. I write this code below but it is not wortking.

[tmr.alarm(0, 1000, 0, function()
wifi.setmode(wifi.STATION)
wifi.sta.config("ssid","password")
ip = wifi.sta.getip()
print(ip)
end )
if ip==nil then
print("again")
else
print(wifi.sta.getap(listap))
function listap(t)
if t then
print("APs:\n")
for k,v in pairs(t) do
l=string.format("%-10s",k)
stringtoarray = {}
index = 1
for value in string.gmatch(v,"%w+") do
stringtoarray [index] = value
index = index + 1
end
print(l,stringtoarray[2])
end

print(#stringtoarray)
else
print("try again")
end
end
end ]

I want to do first the ESP8266 take an IP address then write RSSI and AP but i see different things like on photos in attachments. Can anybody help me?
Attachments
Capture1.JPG
Capture1.JPG (11.1 KiB) Viewed 2594 times
Capture.JPG
Capture.JPG (18.21 KiB) Viewed 2594 times