global url
methods
url.hashed
function url.hashed(str: string) -> Url {
scheme = string,
authority = string,
filename = string,
path = string,
port = string,
query = string,
queries = table,
fragment = string,
original = string,
noscheme = boolean,
}
A string is split into a hash table with these keys using the following function:
The hash variant is more tolerant than the split. In the hash there is also a key original
that holds
the original URL and and the boolean noscheme indicates if there is a scheme at all.
Example:
url.hashed("foo://example.com:2010/alpha/beta?gamma=delta#epsilon")
t = {
["authority"] = "example.com:2010",
["filename"] = "example.com:2010/alpha/beta",
["fragment"] = "epsilon",
["host"] = "example.com",
["noscheme"] = false,
["original"] = "foo://example.com:2010/alpha/beta?gamma=delta#epsilon",
["path"] = "alpha/beta",
["port"] = 2010,
["queries"] = {["gamma"] = "delta"},
["query"] = "gamma=delta",
["scheme"] = "foo"
}
url.hashed("alpha/beta")
t = {
["authority"] = "",
["filename"] = "alpha/beta",
["fragment"] = "",
["noscheme"] = true,
["original"] = "alpha/beta",
["path"] = "alpha/beta",
["query"] = "",
["scheme"] = "file"
}
- Corresponding Lua source code: lualibs-url.lua#L184-L250
url.split
Example:
url.split("foo://example.com:2010/alpha/beta?gamma=delta#epsilon")
t={ "foo", "example.com:2010", "alpha/beta", "gamma=delta", "epsilon" }
url.split("alpha/beta")
t = {"", "", "", "", ""}
- Corresponding Lua source code: lualibs-url.lua#L132-L134
url.construct
function url.construct(hash: Url {
scheme = string,
authority = string,
filename = string,
path = string,
port = string,
query = string,
queries = table,
fragment = string,
original = string,
noscheme = boolean,
}) -> string
- Corresponding Lua source code: lualibs-url.lua#L289-L322
url.hasscheme
Example:
url.hasscheme("http://www.pragma-ade.com/cow.png") -- 'http'
url.hasscheme("www.pragma-ade.com/cow.png") -- false
- Corresponding Lua source code: lualibs-url.lua#L138-L145
url.addscheme
Example:
url.addscheme("www.pragma-ade.com/cow.png","http://")
-- http://:///www.pragma-ade.com/cow.png
url.addscheme("www.pragma-ade.com/cow.png")
-- file:///www.pragma-ade.com/cow.png
- Corresponding Lua source code: lualibs-url.lua#L279-L287
url.filename
Example:
- Corresponding Lua source code: lualibs-url.lua#L326-L330
url.query
Example:
- Corresponding Lua source code: lualibs-url.lua#L342-L348
😱 Types incomplete or incorrect? 🙏 Please contribute!
@see url.toquery
url.toquery
Example:
- Corresponding Lua source code: lualibs-url.lua#L350-L365
😱 Types incomplete or incorrect? 🙏 Please contribute!
@see url.query
url.barepath
- Corresponding Lua source code: lualibs-url.lua#L371-L377
url.decode
- Corresponding Lua source code: lualibs-url.lua#L88
url.encode
- Corresponding Lua source code: lualibs-url.lua#L89
url.escape
- Corresponding Lua source code: lualibs-url.lua#L336-L340
url.unescape
- Corresponding Lua source code: lualibs-url.lua#L90
url.unescapeget
- Corresponding Lua source code: lualibs-url.lua#L125-L127