From your impscanwifinetworks() documentation:
From 36, imp.scanwifinetworks() can operate asynchronously: pass a callback into the method and it will be executed when the scan is complete. The callback must have one parameter into which the array of network records is passed (or null if no networks have been detected).
If you initiate a second scan while the first is being run, Squirrel will issue the following error: “scan already running in imp.scanwifinetworks(callback)”.
If WiFi is turned off mid-scan, then the scan is aborted and any networks that have been found thus are returned via the callback function or return value as appropriate.
If the imp is attempting to connect to a router using WPS when imp.scanwifinetworks() is called asynchronously, the callback will be executed immediately and be passed an empty array (ie. indicate there are no nearby WiFi networks).
Can I get some clarity whether null is ever returned? I’ve never seen null returned. Is this a doc error, or is null returned under some circumstances and under others? Returning would be more consistent IMHO.