if I check the aaps var a second later it has the value...
Why is it nil the first time I execute the code???
I tried to delay it, but that doesnt work....(or maybe i did it wrong)...
snip
end
> wifi.setmode(wifi.STATION)
> print("Get available APs...")
Get available APs...wifi.sta.getap(listap)
> print(aaps)
nil
> print(aaps)
<option value=.........................................etc'the code
function trim(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
function listap(t)
aaps = ""
if t then
for k,v in pairs(t) do
ap = string.format("%-10s",k)
ap = trim(ap)
aaps = aaps .. "<option value='".. ap .."'>".. ap .."</option>"
end
end
end
wifi.setmode(wifi.STATION)
print("Get available APs...")
wifi.sta.getap(listap)
print(aaps)