aboutsummaryrefslogtreecommitdiff
path: root/data/core/common.lua
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2021-06-13 21:28:29 -0400
committerjgmdev <jgmdev@gmail.com>2021-06-13 21:28:29 -0400
commite070dbebc143de9bbb21ebfbacb89cc5a2f8d0ff (patch)
tree048b433c5daf10020d43e1bf3ae45d9ef22719b3 /data/core/common.lua
parent98164f6d4f7e70d70710804c7baa31a8d93c19b9 (diff)
downloadlite-xl-e070dbebc143de9bbb21ebfbacb89cc5a2f8d0ff.tar.gz
lite-xl-e070dbebc143de9bbb21ebfbacb89cc5a2f8d0ff.zip
Fix undeclared NagView findindex() by moving it to common.
Diffstat (limited to 'data/core/common.lua')
-rw-r--r--data/core/common.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/data/core/common.lua b/data/core/common.lua
index 155d4ddb..b7dd61db 100644
--- a/data/core/common.lua
+++ b/data/core/common.lua
@@ -22,6 +22,13 @@ function common.round(n)
end
+function common.find_index(tbl, prop)
+ for i, o in ipairs(tbl) do
+ if o[prop] then return i end
+ end
+end
+
+
function common.lerp(a, b, t)
if type(a) ~= "table" then
return a + (b - a) * t