diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-03-06 16:38:49 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-03-06 16:38:49 -0800 |
commit | 6a3098d0e93cff07045f27c231cf30114bb013a1 (patch) | |
tree | ed98c3ac12f09ca948917cad6a19a2b05b8c8371 /lisp.tlv | |
parent | 5758f6c082af702e8e2c6c6e6d88f987b3deedee (diff) | |
download | teliva-6a3098d0e93cff07045f27c231cf30114bb013a1.tar.gz |
use method syntax where possible
Perhaps this is a bad idea. It feels arbitrary, what methods Lua happens to include in string and table objects without having to go through the respective modules.
Diffstat (limited to 'lisp.tlv')
-rw-r--r-- | lisp.tlv | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp.tlv b/lisp.tlv index 92d23f8..1165cc6 100644 --- a/lisp.tlv +++ b/lisp.tlv @@ -23,7 +23,7 @@ >-- index characters using [] >getmetatable('').__index = function(str,i) > if type(i) == 'number' then - > return string.sub(str,i,i) + > return str:sub(i,i) > else > return string[i] > end @@ -32,11 +32,11 @@ >-- ranges using (), selected bytes using {} >getmetatable('').__call = function(str,i,j) > if type(i)~='table' then - > return string.sub(str,i,j) + > return str:sub(i,j) > else > local t={} > for k,v in ipairs(i) do - > t[k]=string.sub(str,v,v) + > t[k]=str:sub(v,v) > end > return table.concat(t) > end |