Mercurial Hosting > lang
view src/lib/Utils.luan @ 25:3a80ddafe5a4
courses work
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 01 Aug 2025 00:33:51 -0600 |
parents | f5425a3c1898 |
children | d34d709a7a8e |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local pairs = Luan.pairs or error() local Http = require "luan:http/Http.luan" local Utils = {} function Utils.base_url() local request = Http.request return request.scheme.."://"..request.headers["Host"] end function Utils.shallow_copy(t) local rtn = {} for key, val in pairs(t) do rtn[key] = val end return rtn end function Utils.get_first(t) return pairs(t)() end return Utils