Post your best Lua script examples here

User avatar
By HermannSW
#20163 I did install latest nodemcu firmware yesterday.

In NodeMCU I try to excecute the command from wifi.ap.setip() doc
http://www.nodemcu.com/docs/wifi-ap-module/#wifi-ap-module-wifi-ap-setip

but it fails:
Code: Select all> cfg =
  {
    "ip":"192.168.1.1",
    "netmask":"255.255.255.0",
    "gateway":"192.168.1.1"
  }>> stdin:3: '}' expected (to close '{' at line 2) near ':'
>
stdin:1: unexpected symbol near '}'
>
> tst={"a":"b"}
stdin:1: '}' expected near ':'
>


Is the documentation wrong, or does latest firmware have a bug?

Is there any workaround to set the AP ip address?
(it is 192.168.4.1 currently)

My ESP8266-01 mode is 3 (STA+AP), and I telnet into NodeMCU Telnet server over WiFi:
Image

Hermann.
User avatar
By HermannSW
#20202 Thank you, changing AP IP address worked!

Did I get the wrong NodeMCU API description (JavaScript instead of Lua)?
Or is the sample under this link plain wrong?
http://www.nodemcu.com/docs/wifi-ap-module/#wifi-ap-module-wifi-ap-setip

Code: Select allcfg={
  ip="192.168.179.1",
  netmask="255.255.255.0",
  gateway="192.168.179.1"
}
wifi.ap.setip(cfg)


Hermann.