Docs
LuaJIT

LuaJIT

How to install and use Ada in a LuaJIT or OpenResty project

Ada has a LuaJIT / OpenResty client available on Github, and also on luarocks.org and https://opm.openresty.org/.

Installation

Using LuaRocks

 luarocks install lua-resty-ada
 luarocks install lua-resty-ada

LuaRocks repository for lua-resty-ada is located at luarocks.org/modules/bungle/lua-resty-ada.

Using OpenResty Package Manager

 opm get bungle/lua-resty-ada
 opm get bungle/lua-resty-ada

OPM repository for lua-resty-ada is located at opm.openresty.org/package/bungle/lua-resty-ada.

Usage

Please consult the API documentation for a more detailed information.

URL class

The resty.ada can parse URL and return an instance of URL:

local ada_url = require("resty.ada")
local url = ada_url.parse("https://example.org/path/file.txt")
local protocol = url:get_protocol()
url:free() -- explicit free (garbage collector would do it implicitly) 
print(protocol) -- "https:"
local ada_url = require("resty.ada")
local url = ada_url.parse("https://example.org/path/file.txt")
local protocol = url:get_protocol()
url:free() -- explicit free (garbage collector would do it implicitly) 
print(protocol) -- "https:"

Static functions

The library can also be used without creating instances:

local ada_url = require("resty.ada")
local protocol = ada_url.get_protocol("https://example.org/path/file.txt")
print(protocol) -- "https:"
local ada_url = require("resty.ada")
local protocol = ada_url.get_protocol("https://example.org/path/file.txt")
print(protocol) -- "https:"

Resources