about summary refs log tree commit diff stats
path: root/type.lua
diff options
context:
space:
mode:
authorCase Duckworth2024-04-09 22:48:12 -0500
committerCase Duckworth2024-04-09 22:48:12 -0500
commitff222d305ecc5625a68e5b61d6f03f6201676dd4 (patch)
tree2d80436f7008dc6b76aa7a31471d2218065f9f52 /type.lua
parentFix buffering (diff)
downloadlam-ff222d305ecc5625a68e5b61d6f03f6201676dd4.tar.gz
lam-ff222d305ecc5625a68e5b61d6f03f6201676dd4.zip
Implement strings
Diffstat (limited to 'type.lua')
-rw-r--r--type.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/type.lua b/type.lua index c205468..0000bfb 100644 --- a/type.lua +++ b/type.lua
@@ -207,9 +207,16 @@ function m.list (items, final)
207 return tolist(final or m.null, items) 207 return tolist(final or m.null, items)
208end 208end
209 209
210-- strings are vectors of chars 210-- strings are vectors of chars. not lam characters, but one-character strings.
211-- this is for utf8 ease-of-use... TODO i still need to write functions to pluck
212-- out a single lam character from a string, etc.
211function m.string (x) 213function m.string (x)
212 local t = tochars(tostring(x)) 214 local t
215 if m.luatype(x) == "table" then
216 t = x
217 else
218 t = tochars(tostring(x))
219 end
213 local mt = { 220 local mt = {
214 __type = "string", 221 __type = "string",
215 __tostring = 222 __tostring =