function Getss()
Config = {}
Config.ssid = "myssid"
Config.channel = 4
wifi.setmode(wifi.STATION)
wifi.sta.getap(Config, function(t)
SigStrength = "No signal"
for k,v in pairs(t) do
if k == "myssid" then
SigStrength = string.sub(v, 3, 5) .. " dbm"
break
end
end
print("Signal strength: " .. SigStrength)
end)
end
Getss()
print("fred")
I would expect an output like this
> dofile("SigStrength.lua");
> Signal strength: -29 dbm
fred
But I get
> dofile("SigStrength.lua");
fred
> Signal strength: -29 dbm
In the actual code, I want the function to return the signal strength so that it can be inserted into the HTML, but this problem causes an attempt to insert null data into the string.
Any ideas?