URL Functions

scop.url.changepath(url,newpath)

Changes the path of an URL
returns: string
> = scop.url.changepath('http://lua.org/index.lp','/demo/index.lp')
http://lua.org/demo/index.lp

scop.url.combine(url,path)

Combines a path to a URL
returns: string
> = scop.url.combine('http://lua.org/demo/index.lp','test.lp')
http://lua.org/demo/test.lp

scop.url.crack(url)

Returns the main components of an URL as a table
returns: table
fileext - filename extension (eg: .lp)
filename - filename (eg: index.lp)
host - host name (eg: www.lua.org)
path - location (eg: /demo/index.lp)
port - port number (eg: 80)
proto - protocol (eg: https)

scop.url.decode(s)

Decodes an URL
returns: string

scop.url.encode(s)

Encodes an URL
returns: string

scop.url.encodefull(s)

Full URL Encode
returns: string
> = scop.url.encodefull('/index.lp')
%2F%69%6E%64%65%78%2E%6C%70

scop.url.genfromhost(s,int)

Generates an URL from a hostname and a port
returns: string
> = scop.url.genfromhost('www.lua.org',80)
http://www.lua.org/
> = scop.url.genfromhost('www.lua.org',443)
https://www.lua.org/

scop.url.getfileext(s)

Extracts the extension from an URL filename
returns: string
scop.url.getfileext('http://host/path/index.lp')
.lp

scop.url.getfilename(s)

Extracts the URL filename
returns: string
> = scop.url.getfilename('http://host/path/index.lp')
index.lp