diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-09-03 14:13:22 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-09-03 14:13:22 -0700 |
commit | e1c5a42f311fdafd88506726bbe480f3fcc2d1a3 (patch) | |
tree | 6628729cc55947d0bd5d306704e88b57680c3514 /keychord.lua | |
parent | 9c72ff1bb4fc1ba08acfb0324079da6fe49f3a4a (diff) | |
download | text.love-e1c5a42f311fdafd88506726bbe480f3fcc2d1a3.tar.gz |
editing source code from within the app
integrated from pong.love via text.love: https://merveilles.town/@akkartik/108933336531898243
Diffstat (limited to 'keychord.lua')
-rw-r--r-- | keychord.lua | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/keychord.lua b/keychord.lua index ba0a47c..7be57d2 100644 --- a/keychord.lua +++ b/keychord.lua @@ -56,9 +56,17 @@ end array = {} function array.find(arr, elem) - for i,x in ipairs(arr) do - if x == elem then - return i + if type(elem) == 'function' then + for i,x in ipairs(arr) do + if elem(x) then + return i + end + end + else + for i,x in ipairs(arr) do + if x == elem then + return i + end end end return nil |