Skip to content

Commit

Permalink
net: rename net.if to net.iface
Browse files Browse the repository at this point in the history
Reserved words are always reserved in Lua, so let's not have people
typing net["if"]...
  • Loading branch information
nwf committed Feb 3, 2020
1 parent 76e9f1a commit 3a58388
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions app/modules/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ field_from_ipaddr(lua_State *L, const char * field_name, ip_addr_t* addr) {
lua_setfield(L, -2, field_name);
}

static int net_if_info( lua_State* L ) {
static int net_iface_info( lua_State* L ) {
int ifidx = luaL_optint(L, 1, 0);

struct netif * nif = eagle_lwip_getif(ifidx);
Expand Down Expand Up @@ -1088,9 +1088,9 @@ LROT_BEGIN(net_dns)
LROT_FUNCENTRY( resolve, net_dns_static )
LROT_END( net_dns, net_dns, 0 )

LROT_BEGIN(net_if)
LROT_FUNCENTRY( info, net_if_info )
LROT_END(net_if, net_if, 0)
LROT_BEGIN(net_iface)
LROT_FUNCENTRY( info, net_iface_info )
LROT_END(net_iface, net_iface, 0)

LROT_BEGIN(net)
LROT_FUNCENTRY( createServer, net_createServer )
Expand All @@ -1099,7 +1099,7 @@ LROT_BEGIN(net)
LROT_FUNCENTRY( multicastJoin, net_multicastJoin )
LROT_FUNCENTRY( multicastLeave, net_multicastLeave )
LROT_TABENTRY( dns, net_dns )
LROT_TABENTRY( if, net_if )
LROT_TABENTRY( iface, net_iface )
#ifdef TLS_MODULE_PRESENT
LROT_TABENTRY( cert, tls_cert )
#endif
Expand Down
8 changes: 4 additions & 4 deletions docs/modules/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -618,14 +618,14 @@ Sets the IP of the DNS server used to resolve hostnames. Default: resolver1.open
#### See also
[`net.dns:getdnsserver()`](#netdnsgetdnsserver)

# net.if Module
# net.iface Module

## net.if.info()
## net.iface.info()

Return information about a network interface, specified by index.

#### Syntax
`net.if.info(if_index)`
`net.iface.info(if_index)`

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

#### Example

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

# net.cert Module
Expand Down

0 comments on commit 3a58388

Please sign in to comment.