about summary refs log tree commit diff stats
path: root/template.tlv
diff options
context:
space:
mode:
Diffstat (limited to 'template.tlv')
-rw-r--r--template.tlv14
1 files changed, 7 insertions, 7 deletions
diff --git a/template.tlv b/template.tlv
index aa78955..ba92fbf 100644
--- a/template.tlv
+++ b/template.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
@@ -201,7 +201,7 @@
   count_letters:
     >function count_letters(s)
     >  local result = {}
-    >  for i=1,string.len(s) do
+    >  for i=1,s:len() do
     >    local c = s[i]
     >    if result[c] == nil then
     >      result[c] = 1
@@ -257,7 +257,7 @@
     >    end
     >  end
     >  h.addstr = function(self, s)
-    >    for i=1,string.len(s) do
+    >    for i=1,s:len() do
     >      self:addch(s[i])
     >    end
     >  end
@@ -277,7 +277,7 @@
   kbd:
     >function kbd(keys)
     >  local result = {}
-    >  for i=1,string.len(keys) do
+    >  for i=1,keys:len() do
     >    table.insert(result, keys[i])
     >  end
     >  return result
@@ -299,7 +299,7 @@
   check_screen:
     >function check_screen(window, contents, message)
     >  local x, y = 1, 1
-    >  for i=1,string.len(contents) do
+    >  for i=1,contents:len() do
     >    check_eq(contents[i], window.scr[y][x], message..'/'..y..','..x)
     >    x = x+1
     >    if x > window.scr.w then