From ff222d305ecc5625a68e5b61d6f03f6201676dd4 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 9 Apr 2024 22:48:12 -0500 Subject: Implement strings --- type.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'type.lua') 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) return tolist(final or m.null, items) end --- strings are vectors of chars +-- strings are vectors of chars. not lam characters, but one-character strings. +-- this is for utf8 ease-of-use... TODO i still need to write functions to pluck +-- out a single lam character from a string, etc. function m.string (x) - local t = tochars(tostring(x)) + local t + if m.luatype(x) == "table" then + t = x + else + t = tochars(tostring(x)) + end local mt = { __type = "string", __tostring = -- cgit 1.4.1-21-gabe81