From 016e60c2669f956ba99ba17eb122c8f9e19b6c0e Mon Sep 17 00:00:00 2001 From: shagu Date: Thu, 9 Aug 2018 21:03:50 +0200 Subject: [PATCH] libtipscan: get rid of the stripPos function --- libs/libtipscan.lua | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/libs/libtipscan.lua b/libs/libtipscan.lua index a717fe47..80e2fe43 100644 --- a/libs/libtipscan.lua +++ b/libs/libtipscan.lua @@ -55,14 +55,6 @@ local getText = function(obj) return text end -local stripPos = function(...) - if arg[1] then - table.remove(arg,1) - table.remove(arg,1) - end - return unpack(arg) -end - local findText = function(obj, text, exact) local name = obj:GetName() for i=1, obj:NumLines() do @@ -74,11 +66,17 @@ local findText = function(obj, text, exact) return i, text end else - if left and (string.find(left, text)) then - return i, stripPos(string.find(left,text)) + if left then + local found,_,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10 = string.find(left, text) + if found then + return i, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10 + end end - if right and (string.find(right, text)) then - return i, stripPos(string.find(right,text)) + if right then + local found,_,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10 = string.find(right, text) + if found then + return i, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10 + end end end end