From b7206475238e216eff3725fa10f3fc47dc380388 Mon Sep 17 00:00:00 2001 From: Andreas Bielawski Date: Sun, 14 Aug 2016 23:04:59 +0200 Subject: [PATCH] =?UTF-8?q?NAT=C3=9CRLICH=20FEHLT=20EINE=20GANZE=20FUNKTIO?= =?UTF-8?q?N?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- otouto/utilities.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/otouto/utilities.lua b/otouto/utilities.lua index 45025d1..abab0a4 100644 --- a/otouto/utilities.lua +++ b/otouto/utilities.lua @@ -212,6 +212,18 @@ function utilities:answer_inline_query(inline_query, results, cache_time, is_per } ) end + -- get the indexed word in a string +function utilities.get_word(s, i) + s = s or '' + i = i or 1 + local n = 0 + for w in s:gmatch('%g+') do + n = n + 1 + if n == i then return w end + end + return false +end + -- Returns the string after the first space. function utilities.input(s) if not s:find(' ') then