Skip to content

Commit 3a58388

Browse files
committed
net: rename net.if to net.iface
Reserved words are always reserved in Lua, so let's not have people typing net["if"]...
1 parent 76e9f1a commit 3a58388

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

app/modules/net.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ field_from_ipaddr(lua_State *L, const char * field_name, ip_addr_t* addr) {
10081008
lua_setfield(L, -2, field_name);
10091009
}
10101010

1011-
static int net_if_info( lua_State* L ) {
1011+
static int net_iface_info( lua_State* L ) {
10121012
int ifidx = luaL_optint(L, 1, 0);
10131013

10141014
struct netif * nif = eagle_lwip_getif(ifidx);
@@ -1088,9 +1088,9 @@ LROT_BEGIN(net_dns)
10881088
LROT_FUNCENTRY( resolve, net_dns_static )
10891089
LROT_END( net_dns, net_dns, 0 )
10901090

1091-
LROT_BEGIN(net_if)
1092-
LROT_FUNCENTRY( info, net_if_info )
1093-
LROT_END(net_if, net_if, 0)
1091+
LROT_BEGIN(net_iface)
1092+
LROT_FUNCENTRY( info, net_iface_info )
1093+
LROT_END(net_iface, net_iface, 0)
10941094

10951095
LROT_BEGIN(net)
10961096
LROT_FUNCENTRY( createServer, net_createServer )
@@ -1099,7 +1099,7 @@ LROT_BEGIN(net)
10991099
LROT_FUNCENTRY( multicastJoin, net_multicastJoin )
11001100
LROT_FUNCENTRY( multicastLeave, net_multicastLeave )
11011101
LROT_TABENTRY( dns, net_dns )
1102-
LROT_TABENTRY( if, net_if )
1102+
LROT_TABENTRY( iface, net_iface )
11031103
#ifdef TLS_MODULE_PRESENT
11041104
LROT_TABENTRY( cert, tls_cert )
11051105
#endif

docs/modules/net.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -618,14 +618,14 @@ Sets the IP of the DNS server used to resolve hostnames. Default: resolver1.open
618618
#### See also
619619
[`net.dns:getdnsserver()`](#netdnsgetdnsserver)
620620

621-
# net.if Module
621+
# net.iface Module
622622

623-
## net.if.info()
623+
## net.iface.info()
624624

625625
Return information about a network interface, specified by index.
626626

627627
#### Syntax
628-
`net.if.info(if_index)`
628+
`net.iface.info(if_index)`
629629

630630
#### Parameters
631631
- `if_index` the interface index; on ESP8266, `0` is the wifi client (STA) and `1`
@@ -652,7 +652,7 @@ reported here; use [`net.dns:getdnsserver()`](#netdnsgetdnsserver).
652652

653653
#### Example
654654

655-
`print(net.if.info(0).dhcp.ntp_server)` will show the NTP server suggested by
655+
`print(net.iface.info(0).dhcp.ntp_server)` will show the NTP server suggested by
656656
the DHCP server.
657657

658658
# net.cert Module

0 commit comments

Comments
 (0)