From 4ff9f5bb071a7979026af2f9cc27a52d85a36b65 Mon Sep 17 00:00:00 2001 From: Robin Malley Date: Tue, 20 Jun 2023 01:11:42 +0000 Subject: [PATCH] Clean up dead code Use luachheck to remove code that is no longer used --- src/lua/addon.lua | 1 - src/lua/cache.lua | 3 --- src/lua/endpoints/api_get.lua | 12 ++++-------- src/lua/endpoints/archive_get.lua | 6 +++--- src/lua/endpoints/bio_get.lua | 5 +---- src/lua/endpoints/bio_post.lua | 3 --- src/lua/endpoints/claim_post.lua | 7 ++----- src/lua/endpoints/delete_post.lua | 3 --- src/lua/endpoints/download_get.lua | 6 +----- src/lua/endpoints/edit_get.lua | 6 ++---- src/lua/endpoints/edit_post.lua | 5 +---- src/lua/endpoints/index_get.lua | 4 ++-- src/lua/endpoints/login_get.lua | 1 - src/lua/endpoints/login_post.lua | 2 +- src/lua/endpoints/logout_get.lua | 2 +- src/lua/endpoints/paste_post.lua | 16 ++-------------- src/lua/endpoints/preview_post.lua | 3 --- src/lua/endpoints/read_get.lua | 21 ++++++++++----------- src/lua/endpoints/search_get.lua | 13 +------------ src/lua/hooks.lua | 4 ++-- src/lua/init.lua | 8 ++------ src/lua/pages.lua | 2 +- src/lua/session.lua | 15 ++++++--------- src/lua/tags.lua | 9 ++++----- src/lua/types.lua | 2 +- src/lua/util.lua | 14 ++++++-------- 26 files changed, 53 insertions(+), 120 deletions(-) diff --git a/src/lua/addon.lua b/src/lua/addon.lua index 6a84177..cb1287d 100644 --- a/src/lua/addon.lua +++ b/src/lua/addon.lua @@ -38,6 +38,5 @@ available. local oldconfigure = configure function configure(...) - return oldconfigure(...) end diff --git a/src/lua/cache.lua b/src/lua/cache.lua index 86e5e3f..8d433bf 100644 --- a/src/lua/cache.lua +++ b/src/lua/cache.lua @@ -9,9 +9,6 @@ and the kore parent process will restart with a fresh, empty cache. ]] local sql = require("lsqlite3") - -local queries = require("queries") -local util = require("util") local db = require("db") local ret = {} diff --git a/src/lua/endpoints/api_get.lua b/src/lua/endpoints/api_get.lua index 82ece73..91a2950 100644 --- a/src/lua/endpoints/api_get.lua +++ b/src/lua/endpoints/api_get.lua @@ -1,5 +1,3 @@ -local cache = require("cache") -local sql = require("lsqlite3") local db = require("db") local queries = require("queries") local util = require("util") @@ -26,16 +24,14 @@ local function suggest_tags(req,data) sufficiently backtrack-ey search/tag combination. ]] assert(data:match("^[a-zA-Z0-9,%s-]+$"),string.format("Bad characters in tag: %q",data)) - stmnt_tags_get:bind_names{ - match = data .. "%" - } - local tags = {data} + stmnt_tags_get:bind_names{match = data .. "%"} + local sug_tags = {data} for tag in stmnt_tags_get:rows() do - table.insert(tags,tag[1]) + table.insert(sug_tags,tag[1]) end stmnt_tags_get:reset() http_response_header(req,"Content-Type","text/plain") - http_response(req,200,table.concat(tags,";")) + http_response(req,200,table.concat(sug_tags,";")) end --[[ diff --git a/src/lua/endpoints/archive_get.lua b/src/lua/endpoints/archive_get.lua index ab2896c..9e4a06e 100644 --- a/src/lua/endpoints/archive_get.lua +++ b/src/lua/endpoints/archive_get.lua @@ -1,7 +1,7 @@ local config = require("config") local function archive(req) - local archive = assert(io.open(config.approot .. "data/archive.zip","rb")) + local archive_fp = assert(io.open(config.approot .. "data/archive.zip","rb")) --[=[ local archive_size = archive:seek("end") archive:seek("set") @@ -51,7 +51,7 @@ local function archive(req) ]] ]=] http_response_header(req,"Content-Disposition","attachment; filename=\"slash_monster_archive.zip\"") - http_response(req,200,archive:read("*a")) - archive:close() + http_response(req,200,archive_fp:read("*a")) + archive_fp:close() end return archive diff --git a/src/lua/endpoints/bio_get.lua b/src/lua/endpoints/bio_get.lua index 4866f84..18f82e3 100644 --- a/src/lua/endpoints/bio_get.lua +++ b/src/lua/endpoints/bio_get.lua @@ -3,7 +3,6 @@ local sql = require("lsqlite3") local db = require("db") local queries = require("queries") -local util = require("util") local pages = require("pages") local session = require("session") local config = require("config") @@ -16,13 +15,11 @@ function configure(...) end local function bio_edit_get(req) - local host = http_request_get_host(req) - local path = http_request_get_path(req) local author, authorid = session.get(req) http_request_populate_qs(req) local ret - + if (not author) or (not authorid) then ret = pages.error{ errcode = 401, diff --git a/src/lua/endpoints/bio_post.lua b/src/lua/endpoints/bio_post.lua index b4ab2aa..56fe433 100644 --- a/src/lua/endpoints/bio_post.lua +++ b/src/lua/endpoints/bio_post.lua @@ -19,8 +19,6 @@ function configure(...) end local function edit_bio(req) - local host = http_request_get_host(req) - local path = http_request_get_path(req) local author, author_id = session.get(req) if not (author and author_id) then local response = pages.error{ @@ -38,7 +36,6 @@ local function edit_bio(req) local parsed = parsers.plain(text) -- Make sure the plain parser can deal with it, even though we don't store this result. local compr_raw = zlib.compress(text) - local compr = zlib.compress(parsed) db.sqlbind(stmnt_update_bio, "bind_blob", 1,compr_raw) db.sqlbind(stmnt_update_bio, "bind", 2, author_id) diff --git a/src/lua/endpoints/claim_post.lua b/src/lua/endpoints/claim_post.lua index 537348a..445190b 100644 --- a/src/lua/endpoints/claim_post.lua +++ b/src/lua/endpoints/claim_post.lua @@ -3,7 +3,6 @@ local sql = require("lsqlite3") local pages = require("pages") local db = require("db") local queries = require("queries") -local util = require("util") local sessionlib = require("session") local config = require("config") @@ -54,7 +53,7 @@ local function claim_post(req) --Give them a file back http_response_header(req,"Content-Type","application/octet-stream") http_response_header(req,"Content-Disposition","attachment; filename=\"" .. name .. "." .. config.domain .. ".passfile\"") - local session = sessionlib.start(id) + sessionlib.start(id) text = password http_response(req,200,text) return @@ -67,9 +66,7 @@ local function claim_post(req) elseif err == sql.ERROR or err == sql.MISUSE then log(LOG_ALERT,"Account creation failed in an unusual way:" .. err) --This is bad though - text = pages.claim { - err = "Failed to claim" - } + text = pages.claim {err = "Failed to claim"} end stmnt_author_create:reset() http_response(req,200,text) diff --git a/src/lua/endpoints/delete_post.lua b/src/lua/endpoints/delete_post.lua index fcb676b..cfc81e4 100644 --- a/src/lua/endpoints/delete_post.lua +++ b/src/lua/endpoints/delete_post.lua @@ -1,4 +1,3 @@ -local tags = require("tags") local util = require("util") local pages = require("pages") local config = require("config") @@ -29,8 +28,6 @@ api.get.page_owner = function(env) end local function delete_post(req) - local host = http_request_get_host(req) - local path = http_request_get_path(req) http_request_populate_post(req) local storystr = assert(http_argument_get_string(req,"story")) print("Looking at storystr:",storystr) diff --git a/src/lua/endpoints/download_get.lua b/src/lua/endpoints/download_get.lua index 18c86b5..ad0055a 100644 --- a/src/lua/endpoints/download_get.lua +++ b/src/lua/endpoints/download_get.lua @@ -33,17 +33,13 @@ api.get.page_reader = function(env) end local function download_get(req) - local host = http_request_get_host(req) - local path = http_request_get_path(req) http_request_populate_qs(req) local story = assert(http_argument_get_string(req,"story")) local hashstr = http_argument_get_string(req,"pwd") local ihash = hashstr and util.decode_unlisted(hashstr) story = util.decodeentities(story) local story_id = util.decode_id(story) - stmnt_download:bind_names{ - postid = story_id - } + stmnt_download:bind_names{postid = story_id} local err = db.do_sql(stmnt_download) if err == sql.DONE then --No rows, story not found diff --git a/src/lua/endpoints/edit_get.lua b/src/lua/endpoints/edit_get.lua index 743e394..f42c9f4 100644 --- a/src/lua/endpoints/edit_get.lua +++ b/src/lua/endpoints/edit_get.lua @@ -30,8 +30,6 @@ api.get.page_owner = function(env) end local function edit_get(req) - local host = http_request_get_host(req) - local path = http_request_get_path(req) local author, authorid = session.get(req) http_request_populate_qs(req) @@ -60,8 +58,8 @@ local function edit_get(req) local data = stmnt_edit:get_values() local txt_compressed, markup, isanon, title, unlisted = unpack(data) local text = zlib.decompress(txt_compressed) - local tags = tags.get(story_id) - local tags_txt = table.concat(tags,";") + local tags_raw = tags.get(story_id) + local tags_txt = table.concat(tags_raw,";") stmnt_edit:reset() ret = pages.edit{ title = title, diff --git a/src/lua/endpoints/edit_post.lua b/src/lua/endpoints/edit_post.lua index f94ed56..5796806 100644 --- a/src/lua/endpoints/edit_post.lua +++ b/src/lua/endpoints/edit_post.lua @@ -23,8 +23,6 @@ function configure(...) end local function edit_post(req) - local host = http_request_get_host(req) - local path = http_request_get_path(req) local author, author_id = session.get(req) http_request_populate_post(req) @@ -86,11 +84,10 @@ local function edit_post(req) stmnt_update:reset() tagslib.set(storyid,tags) local id_enc = util.encode_id(storyid) - local hash local loc = string.format("https://%s/%s",config.domain,id_enc) if unlisted then stmnt_hash:bind_names{id=storyid} - local err = db.do_sql(stmnt_hash) + err = db.do_sql(stmnt_hash) if err ~= sql.ROW then error("Failed to get a post's hash while trying to make it unlisted") end diff --git a/src/lua/endpoints/index_get.lua b/src/lua/endpoints/index_get.lua index 7197a87..4f568f0 100644 --- a/src/lua/endpoints/index_get.lua +++ b/src/lua/endpoints/index_get.lua @@ -56,7 +56,7 @@ local function get_author_home(req, loggedin) local host = http_request_get_host(req) local subdomain = host:match("([^\\.]+)") stmnt_author_bio:bind_names{author=subdomain} - local author, authorid = session.get(req) + local author, _ = session.get(req) local err = db.do_sql(stmnt_author_bio) if err == sql.DONE then log(LOG_INFO,"No such author:" .. subdomain) @@ -118,7 +118,7 @@ local function index_get(req) local method = http_method_text(req) local host = http_request_get_host(req) local subdomain = host:match("([^\\.]+)") - local author, authorid = session.get(req) + local author, _ = session.get(req) local text if host == config.domain and author == nil then --Default home page diff --git a/src/lua/endpoints/login_get.lua b/src/lua/endpoints/login_get.lua index 0aa754b..d94b67f 100644 --- a/src/lua/endpoints/login_get.lua +++ b/src/lua/endpoints/login_get.lua @@ -1,4 +1,3 @@ -local config = require("config") local cache = require("cache") local config = require("config") local pages = require("pages") diff --git a/src/lua/endpoints/login_post.lua b/src/lua/endpoints/login_post.lua index 9868c59..e4f8b64 100644 --- a/src/lua/endpoints/login_post.lua +++ b/src/lua/endpoints/login_post.lua @@ -1,7 +1,6 @@ local sql = require("lsqlite3") local db = require("db") -local util = require("util") local session = require("session") local config = require("config") local pages = require("pages") @@ -33,6 +32,7 @@ function api.authenticate(data) if hash == passhash then return id end + return old_authenticate(data) end local function login_post(req) diff --git a/src/lua/endpoints/logout_get.lua b/src/lua/endpoints/logout_get.lua index 2361aed..b30808a 100644 --- a/src/lua/endpoints/logout_get.lua +++ b/src/lua/endpoints/logout_get.lua @@ -2,7 +2,7 @@ local session = require("session") local config = require("config") local function logout(req) - local author, authorid = session.get(req) + local _, authorid = session.get(req) session.finish(authorid) http_response_header(req,"Location","https://" .. config.domain) http_response(req,303,"") diff --git a/src/lua/endpoints/paste_post.lua b/src/lua/endpoints/paste_post.lua index c2e3b16..32b3d48 100644 --- a/src/lua/endpoints/paste_post.lua +++ b/src/lua/endpoints/paste_post.lua @@ -34,7 +34,7 @@ local function anon_paste(req,ps) since there are only 32 bits of address. Someone who got a copy of the database could just generate all 2^32 hashes and look up who posted - what. Use IPv6, Tor or I2P where possible. (but then I + what. Use IPv6, Tor or I2P where possible. (but then I guess it's harder to ban spammers... hmm..) ]] --local ip = http_request_get_ip(req) @@ -93,7 +93,6 @@ end local function author_paste(req,ps) --Author paste local author, authorid = session.get(req) - local ret if author == nil then ret = pages.author_paste{ domain = config.domain, @@ -161,19 +160,9 @@ local function author_paste(req,ps) stmnt_paste:reset() end -local function decodeentities(capture) - local n = tonumber(capture,16) - local c = string.char(n) - if escapes[c] then - return escapes[c] - else - return c - end -end local function paste_post(req) local host = http_request_get_host(req) - local path = http_request_get_path(req) - + local ps = {} --We're creating a new paste ps.subdomain = host:match("([^\\.]+)") @@ -186,7 +175,6 @@ local function paste_post(req) if tag_str then ps.tags = util.parse_tags(tag_str) end - local pasteas ps.raw = zlib.compress(text) text = util.decodeentities(text) text = parsers[ps.markup](text) diff --git a/src/lua/endpoints/preview_post.lua b/src/lua/endpoints/preview_post.lua index 90ec057..7f0142f 100644 --- a/src/lua/endpoints/preview_post.lua +++ b/src/lua/endpoints/preview_post.lua @@ -1,12 +1,9 @@ local parsers = require("parsers") -local tags = require("tags") local util = require("util") local pages = require("pages") local config = require("config") local function preview_post(req) - local host = http_request_get_host(req) - local path = http_request_get_path(req) http_request_populate_post(req) local title = assert(http_argument_get_string(req,"title")) local text = assert(http_argument_get_string(req,"text")) diff --git a/src/lua/endpoints/read_get.lua b/src/lua/endpoints/read_get.lua index 3019b6e..fef9225 100644 --- a/src/lua/endpoints/read_get.lua +++ b/src/lua/endpoints/read_get.lua @@ -10,13 +10,12 @@ local pages = require("pages") local config = require("config") local zlib = require("zlib") -local stmnt_read, stmnt_update_views, stmnt_comments +local stmnt_read, stmnt_update_views local oldconfigure = configure function configure(...) stmnt_read = db.sqlassert(db.conn:prepare(queries.select_post)) stmnt_update_views = db.sqlassert(db.conn:prepare(queries.update_views)) - stmnt_comments = db.sqlassert(db.conn:prepare(queries.select_comments)) return oldconfigure(...) end @@ -26,7 +25,7 @@ Increases a story's hit counter by 1 ]] local function add_view(storyid) stmnt_update_views:bind_names{ - id = storyid + id = storyid } local err = db.do_sql(stmnt_update_views) assert(err == sql.DONE, "Failed to update view counter:"..tostring(err)) @@ -109,21 +108,21 @@ local function read_get(req) ps.iam = author ps.loggedauthorid = authorid end - + --If we need to show comments http_request_populate_qs(req) ps.show_comments = true if ps.show_comments then ps.comments = util.get_comments(ps.storyid) end - + --If this post is unlisted, get the hash local hashstr = http_argument_get_string(req,"pwd") if hashstr then ps.hash = util.decode_unlisted(hashstr) ps.hashstr = hashstr end - + local text --normal story display if (not ps.loggedauthor) then @@ -159,11 +158,11 @@ local function read_get(req) text = pages.read(ps) end end - - --If this isn't unlisted, dirty everywhere the hit counter is shown - cache.dirty(string.format("%s",config.domain)) - cache.dirty(string.format("%s/%s",config.domain,ps.short)) -- This place to read this post - cache.dirty(string.format("%s.%s",config.domain,ps.short)) -- The author's index page + + --Dirty everywhere the hit counter is shown + cache.dirty(string.format("%s",config.domain)) + cache.dirty(string.format("%s/%s",config.domain,ps.short)) -- This place to read this post + cache.dirty(string.format("%s.%s",config.domain,ps.short)) -- The author's index page assert(text) http_response(req,200,text) diff --git a/src/lua/endpoints/search_get.lua b/src/lua/endpoints/search_get.lua index 7e046ec..7640a06 100644 --- a/src/lua/endpoints/search_get.lua +++ b/src/lua/endpoints/search_get.lua @@ -1,5 +1,3 @@ -local sql = require("lsqlite3") - local db = require("db") local queries = require("queries") local util = require("util") @@ -8,18 +6,9 @@ local pages = require("pages") local config = require("config") local search_parser = require("parser_search") -local stmnt_search -local oldconfigure = configure -function configure(...) - stmnt_search = assert(db.conn:prepare(queries.select_post_tags)) - return oldconfigure(...) -end - local function search_get(req) - local host = http_request_get_host(req) - local path = http_request_get_path(req) http_request_populate_qs(req) - local searchq, err = http_argument_get_string(req,"q") + local searchq, _ = http_argument_get_string(req,"q") if not searchq then local ret = pages.search{ domain = config.domain, diff --git a/src/lua/hooks.lua b/src/lua/hooks.lua index d9b752e..a02d6a3 100644 --- a/src/lua/hooks.lua +++ b/src/lua/hooks.lua @@ -36,7 +36,7 @@ local api = {} Called before any request processing. Returning true "traps" the request, and does not continue calling smr logic. Well-behaved addons should check for -"true" from the detoured function, and return true immediately if the check +"true" from the detoured function, and return true immediately if the check succeeds. @param req {{http_request}} - The request about to be processed @@ -44,7 +44,7 @@ succeeds. ]] api.pre_request = function(req) end --- Called after smr request processing. Returning true "traps" the request. +-- Called after smr request processing. Returning true "traps" the request. -- Well-behaved addons should check for true from the detoured function, and -- immediately return true if the check succeeds. This will not stop smr from -- responding to the request, since by this time http_request_response() has diff --git a/src/lua/init.lua b/src/lua/init.lua index 4e6321e..44d0a8a 100644 --- a/src/lua/init.lua +++ b/src/lua/init.lua @@ -37,8 +37,6 @@ Be sure to always {{doc/appendix/detourin}} print("Really fast print from init.lua") --Luarocks libraries -local et = require("etlua") -local sql = require("lsqlite3") local zlib = require("zlib") local api = require("hooks") @@ -48,9 +46,7 @@ function configure(...) end --smr code require("global") local cache = require("cache") -local pages = require("pages") -local util = require("util") -local config = require("config") +require("pages") local db = require("db") print("Hello from init.lua") @@ -69,7 +65,7 @@ print("Created configure function") -- TODO: Fill this out local http_methods = {"GET","POST"} local http_m_rev = {} -for k,v in pairs(http_methods) do +for _,v in pairs(http_methods) do http_m_rev[v] = true end diff --git a/src/lua/pages.lua b/src/lua/pages.lua index e897536..4331051 100644 --- a/src/lua/pages.lua +++ b/src/lua/pages.lua @@ -42,7 +42,7 @@ local global_env_m = { } local pages = {} local etlua_short_pat = '%[string "etlua"%]' -for k,v in pairs(pagenames) do +for _,v in pairs(pagenames) do local path = string.format(config.approot .. "pages/%s.etlua",v) local parser = et.Parser() local f = assert(io.open(path,"r")) diff --git a/src/lua/session.lua b/src/lua/session.lua index b21d930..73de1f9 100644 --- a/src/lua/session.lua +++ b/src/lua/session.lua @@ -1,7 +1,6 @@ local sql = require("lsqlite3") local db = require("db") -local util = require("util") local queries = require("queries") local stmnt_get_session, stmnt_insert_session, stmnt_delete_session @@ -13,7 +12,7 @@ function configure(...) stmnt_delete_session = db.sqlassert(db.conn:prepare(queries.delete_session)) return oldconfigure(...) end - + local session = {} --[[ @@ -36,9 +35,7 @@ function session.get(req) end local data = stmnt_get_session:get_values() stmnt_get_session:reset() - local author = data[1] - local authorid = data[2] - return author,authorid + return data[1],data[2] end --[[ @@ -47,21 +44,21 @@ Start a session for someone who logged in function session.start(who) local rngf = assert(io.open("/dev/urandom","rb")) local session_t = {} - for i = 1,64 do + for _ = 1,64 do local r = string.byte(rngf:read(1)) local s = string.char((r % 26) + 65) table.insert(session_t,s) end - local session = table.concat(session_t) + local session_str = table.concat(session_t) rngf:close() stmnt_insert_session:bind_names{ - sessionid = session, + sessionid = session_str, authorid = who } local err = db.do_sql(stmnt_insert_session) stmnt_insert_session:reset() assert(err == sql.DONE, "Error should have been 'DONE', was: " .. tostring(err)) - return session + return session_str end --[[ diff --git a/src/lua/tags.lua b/src/lua/tags.lua index e20feb0..fdae324 100644 --- a/src/lua/tags.lua +++ b/src/lua/tags.lua @@ -1,7 +1,7 @@ --[[ md @name lua/tags -Helper methods for cleaning story tags. +Helper methods for cleaning story tags. Tags are the main way to search smr, a simple `+` or `-` will show all stories that include (+) or do not include (-) a particular tag. @@ -13,7 +13,6 @@ local sql = require("lsqlite3") local db = require("db") local queries = require("queries") -local util = require("util") local tags = {} local stmnt_get_tags, stmnt_ins_tag, stmnt_drop_tags @@ -24,7 +23,7 @@ function configure(...) stmnt_ins_tag = assert(db.conn:prepare(queries.insert_tag)) stmnt_get_tags = assert(db.conn:prepare(queries.select_tags)) stmnt_drop_tags = assert(db.conn:prepare(queries.delete_tags)) - + return oldconfigure(...) end @@ -50,12 +49,12 @@ function tags.get(id) until false end -function tags.set(storyid,tags) +function tags.set(storyid,tags_list) assert(stmnt_drop_tags:bind_names{postid = storyid} == sql.OK) db.do_sql(stmnt_drop_tags) stmnt_drop_tags:reset() local err - for _,tag in pairs(tags) do + for _,tag in pairs(tags_list) do assert(stmnt_ins_tag:bind(1,storyid) == sql.OK) assert(stmnt_ins_tag:bind(2,tag) == sql.OK) err = db.do_sql(stmnt_ins_tag) diff --git a/src/lua/types.lua b/src/lua/types.lua index 506c138..5737cac 100644 --- a/src/lua/types.lua +++ b/src/lua/types.lua @@ -22,7 +22,7 @@ local builtin_types = { for _,type_ in pairs(builtin_types) do types[type_] = function(arg) local argtype = type(arg) - if not argtype == type_ then + if argtype ~= type_ then return false, string.format("was not a %s, was a %s",type_,argtype) end end diff --git a/src/lua/util.lua b/src/lua/util.lua index ddfd6dc..58224da 100644 --- a/src/lua/util.lua +++ b/src/lua/util.lua @@ -5,9 +5,7 @@ used in more than one place. ]] -local sql = require("lsqlite3") local config = require("config") -local types = require("types") local db = require("db") local queries = require("queries") @@ -38,15 +36,15 @@ see https://perishablepress.com/stop-using-unsafe-characters-in-urls/ no underscore because we use that for our operative pages A set of legacy characters that are no longer in use (because they were invalid -to use in URL's) is also defined, but unused as long as +to use in URL's) is also defined, but unused as long as {{config/legacy_url_cutoff}} is set to 0. ]] -local url_characters = +local url_characters = [[abcdefghijklmnopqrstuvwxyz]].. [[ABCDEFGHIJKLMNOPQRSTUVWXYZ]].. [[0123456789]] -local url_characters_legacy = +local url_characters_legacy = url_characters .. [[$-+!*'(),]] @@ -120,7 +118,7 @@ Legacy code, try to decode with invalid characters in the url first local new_decode = util.decode_id function util.decode_id(s) local res, id = pcall(function() - local n = 0 + local n = 0 local charlen = string.len(url_characters_legacy) for i = 1,string.len(s) do local char = string.sub(s,i,i) @@ -142,7 +140,7 @@ end --arbitary data to hex encoded string function util.encode_unlisted(str) - assert(type(str) == "string","Tried to encode something not a string:" .. type(Str)) + assert(type(str) == "string","Tried to encode something not a string:" .. type(str)) local safe = {} for i = 1,#str do local byte = str:byte(i) @@ -237,7 +235,7 @@ if config.debugging then end end else - function util.checktypes(...) + function util.checktypes() end end