Post your best Lua script examples here

User avatar
By dpwhittaker
#11603 What about:

Code: Select all  wifi.sta.getap(function(t)
               config.ListAP(t)
               collectgarbage()
               end)


The collect inside the function doesn't do much, because it can't collect the running function... Maybe you are just not collecting at the right time.

If that doesn't work, I'll try it myself when I get in from church tonight.
User avatar
By dpwhittaker
#11631 I read through the nodemcu source and discovered the issue. They don't release the reference to your function after they call it. I think this is a bug, but there is a way to make it happen. Switch back to your original method:

Code: Select allconfig = require "config"
config.ConfigModule()
wifi.sta.getap(config.ListAP)


But in config.ListAP, add this anywhere:

Code: Select allwifi.sta.getap(nil)


I still haven't had a chance to test it myself, but it looks like it will help.
User avatar
By sevic71
#11717 Hi people,
i just try to follow your logic in order to test 'flashed functions' approach with my own scripts, but can't catch where function config.ConfigModule() comes from. It is not implemented within flash module 'config' listed above. I'm confused...