diff options
author | Andrew Lewis <nerf@judo.za.org> | 2023-09-12 11:04:31 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2023-09-12 11:04:31 +0200 |
commit | 798184ee605a5b5997cc99a04d2a1f8463bce6f7 (patch) | |
tree | 660ba8a035dd5713a92ed782435890c1c8a78363 /src/lua | |
parent | 3f18a42c649312e57a6189b5d51533846b03965b (diff) | |
download | rspamd-798184ee605a5b5997cc99a04d2a1f8463bce6f7.tar.gz rspamd-798184ee605a5b5997cc99a04d2a1f8463bce6f7.zip |
[Minor] API docs: lua_ip: fix function name
- Also clarify description
- Make sure example is appropriate
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_ip.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lua/lua_ip.c b/src/lua/lua_ip.c index 92a066406..ac24dc52b 100644 --- a/src/lua/lua_ip.c +++ b/src/lua/lua_ip.c @@ -87,24 +87,24 @@ LUA_FUNCTION_DEF(ip, to_table); * @see ip:to_table() is that this method returns just hex strings for ipv6 * addresses. * @return {table or nil} string octets of IP address or `nil` if IP is invalid + * @example +local ip = rspamd_ip.from_string('fe80::11') +print(table.concat(ip:str_octets(), ".")) +-- Output: +-- f.e.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.1 */ LUA_FUNCTION_DEF(ip, str_octets); /*** - * @method ip:str_octets() + * @method ip:inversed_str_octets() * Converts valid IP address to the table of string octets in reversed order. The difference from * @see ip:to_table() is that this method returns just hex strings for ipv6 - * addresses. + * addresses in reversed order. * @return {table or nil} string octets of IP address or `nil` if IP is invalid * @example -local ip = rspamd_ip.from_string('127.0.0.1') -for _,o in ipairs(ip:to_table()) do - print(o) -end +local ip = rspamd_ip.from_string('fe80::11') +print(table.concat(ip:inversed_str_octets(), ".")) -- Output: --- 1 --- 0 --- 0 --- 127 +-- 1.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f */ LUA_FUNCTION_DEF(ip, inversed_str_octets); /*** |