aboutsummaryrefslogtreecommitdiffstats
path: root/alv
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2022-02-05 12:20:36 +0000
committers-ol <s+removethis@s-ol.nu>2025-03-02 14:24:49 +0000
commit7470fee507f49a7b26dd6ecfb262cc4e0da73f18 (patch)
tree407eb2d1a4377f1ddea462f2764981c34c08e03d /alv
parentbase.match: predicate fn matching (diff)
downloadalive-7470fee507f49a7b26dd6ecfb262cc4e0da73f18.tar.gz
alive-7470fee507f49a7b26dd6ecfb262cc4e0da73f18.zip
lib: test and extend string module
Diffstat (limited to 'alv')
-rw-r--r--alv/type.moon5
1 files changed, 4 insertions, 1 deletions
diff --git a/alv/type.moon b/alv/type.moon
index 765cab2..2e392d8 100644
--- a/alv/type.moon
+++ b/alv/type.moon
@@ -39,6 +39,7 @@ class Type
--- pretty-print a value of this type.
-- @function pp
-- @tparam any value
+ -- @tparam[opt] bool raw whether to print "raw" (strings without quotes)
-- @treturn string
--- check two values of this type for equality.
@@ -75,7 +76,9 @@ class Type
--
-- @type Primitive
class Primitive extends Type
- pp: (value) =>
+ pp: (value, raw) =>
+ return tostring value if raw
+
switch @name
when 'str'
string.format '%q', value