From ec6aed986604885197040a46f9c9d7842a96f37c Mon Sep 17 00:00:00 2001 From: Robin Malley Date: Sun, 26 Jun 2022 23:08:46 +0000 Subject: [PATCH] Add a types module to help refactor type checking Type checking will be performed in unit tests, but will be an empty function at runtime. --- src/lua/types.lua | 4 ++++ src/lua/util.lua | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lua/types.lua b/src/lua/types.lua index 67a6b48..506c138 100644 --- a/src/lua/types.lua +++ b/src/lua/types.lua @@ -44,4 +44,8 @@ function types.matches_pattern(pattern) end end +function types.check(...) + +end + return types diff --git a/src/lua/util.lua b/src/lua/util.lua index edbe672..602246b 100644 --- a/src/lua/util.lua +++ b/src/lua/util.lua @@ -1,14 +1,14 @@ local sql = require("lsqlite3") local config = require("config") +local types = require("types") local util = {} --[[ Runs an sql query and receives the 3 arguments back, prints a nice error message on fail, and returns true on success. ]] -function util.sqlassert(...) - local r,errcode,err = ... +function util.sqlassert(r, errcode, err) if not r then error(string.format("%d: %s",errcode, err)) end