From 97b93c72133e7821cfc72f50b90a5fcae9badb45 Mon Sep 17 00:00:00 2001 From: Oreolek Date: Sat, 15 Aug 2015 06:33:13 +0700 Subject: [PATCH] Emphasis update, rndstr module --- emphasis.lua | 8 +++++++- rndstr.lua | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 rndstr.lua diff --git a/emphasis.lua b/emphasis.lua index f61646d..88e05a1 100644 --- a/emphasis.lua +++ b/emphasis.lua @@ -4,8 +4,14 @@ format.filter = function(text) for _, s in ipairs {"%*%*", "%_%_"} do text = text:gsub(s .. "([^%s][^<>]-[^%s][%*%_]?)" .. s, txtb("%1")); end; - for _, s in ipairs {"%*", "%_"} do + for _, s in ipairs {"%*"} do text = text:gsub(s .. "([^%s_][^<>_]-[^%s_])" .. s, txtem("%1")); end; + for _, s in ipairs {"%_"} do + text = text:gsub(s .. "([^%s_][^<>_]-[^%s_])" .. s, txtu("%1")); + end; + for _, s in ipairs {"%-"} do + text = text:gsub(s .. " ([^%s_][^<>_]-[^%s_]) " .. s, txtst("%1")); + end; return text; end diff --git a/rndstr.lua b/rndstr.lua new file mode 100644 index 0000000..6339763 --- /dev/null +++ b/rndstr.lua @@ -0,0 +1,3 @@ +rndstr = function(strings) + return strings[rnd(stead.table.maxn(strings))]; +end