diff src/lib/Shared.luan @ 20:3ea49246d6a7

bbcode work
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 13 Jul 2022 22:00:00 -0600
parents 24668255cede
children 4fdc4ec0050b
line wrap: on
line diff
--- a/src/lib/Shared.luan	Wed Jul 13 08:47:13 2022 -0600
+++ b/src/lib/Shared.luan	Wed Jul 13 22:00:00 2022 -0600
@@ -2,6 +2,7 @@
 local error = Luan.error
 local ipairs = Luan.ipairs or error()
 local set_metatable = Luan.set_metatable or error()
+local type = Luan.type or error()
 local Http = require "luan:http/Http.luan"
 local Io = require "luan:Io.luan"
 local uri = Io.uri or error()
@@ -85,4 +86,14 @@
 	return set
 end
 
+function Shared.to_list(input)
+	if input == nil then
+		return {}
+	elseif type(input) == "table" then
+		return input
+	else
+		return {input}
+	end
+end
+
 return Shared