about summary refs log tree commit diff stats
path: root/commander.tlv
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-03-06 16:38:49 -0800
committerKartik K. Agaram <vc@akkartik.com>2022-03-06 16:38:49 -0800
commit6a3098d0e93cff07045f27c231cf30114bb013a1 (patch)
treeed98c3ac12f09ca948917cad6a19a2b05b8c8371 /commander.tlv
parent5758f6c082af702e8e2c6c6e6d88f987b3deedee (diff)
downloadteliva-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 'commander.tlv')
-rw-r--r--commander.tlv8
1 files changed, 4 insertions, 4 deletions
diff --git a/commander.tlv b/commander.tlv
index 6b80304..e6854fc 100644
--- a/commander.tlv
+++ b/commander.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,13 +32,13 @@
     >-- 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)
+    >    return t:concat()
     >  end
     >end
     >
c166624a79f0bc962091c603ff8051c9bd'>d39bcdc1 ^
a4b4ed71 ^
30b5f112 ^




45a26b11 ^





30b5f112 ^
71679a31 ^

45a26b11 ^
30b5f112 ^
45a26b11 ^
45a26b11 ^
8a113ad6 ^
2f82f50a ^
86c1c388 ^
1a3dc91e ^
45a26b11 ^

d39bcdc1 ^
fbc30231 ^

















cd2458c0 ^

0ae975c2 ^

b21edfaa ^
cd2458c0 ^
0aa758cb ^

d3cc5bd7 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85