Type checking utilities in pure Lua, for sandboxes without debug library, inspired by the Sierra scheduler checker module.
You can define custom types by
functions by setting checkerAPI.checkers['mytype']=function(object) … end that return a boolean
setting the __type field in the object metatable
Check out the code for the helper function conform for the order on which these are checked;
Simple use:

os.loadAPI('checkerAPI')
check=checkerAPI.check
function foo(int_or_table,optional_string)
check('number|table,?string',int_or_table,optional_string)
print('All is well')
end
foo(1)
--All is well
foo({},'')
--All is well
foo(1,1)
--test.lua:12: arg number 2: 1 of type number is not of type ?string


Includes an API version, a module version, and a test file.
Code: Github