refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-23 17:37:17 +02:00
parent 303ef7f9c3
commit c65417aa9c
3 changed files with 69 additions and 114 deletions
+2 -14
View File
@@ -14,18 +14,6 @@ do
end
end
--do TODO syntactic sugar record '#' {key='string'} {foo='number'}
-- local mt = {
-- __unm = function(self, separator)
-- self.separator = separator
-- end,
-- __call = function(self, field) end
-- }
-- function public.accessor.record()
--
-- end
--end
function public.read(schema, str)
if schema == 'string' then
return str
@@ -38,7 +26,7 @@ function public.read(schema, str)
elseif type(schema) == 'table' and schema[1] == 'record' then
return read_record(schema, str)
else
error 'Invalid schema.'
error('Invalid schema.', 2)
end
end
@@ -54,7 +42,7 @@ function public.write(schema, obj)
elseif type(schema) == 'table' and schema[1] == 'record' then
return write_record(schema, obj)
else
error 'Invalid schema.'
error('Invalid schema.', 2)
end
end