lua-schema icon indicating copy to clipboard operation
lua-schema copied to clipboard

How to limit the var can not be nil

Open xuxiangwork opened this issue 7 years ago • 1 comments

xuxiangwork avatar Mar 08 '17 09:03 xuxiangwork

Hi, there is currently no schema for non-nil values, but it is easy to create, e.g. by using notnil = schema.Test(function(obj) return obj ~= nil end, "must not be nil") schema.CheckSchema(value, notnil)

I might add a schema that checks for non-nil this weekend, if I have the time.

sschoener avatar Mar 10 '17 16:03 sschoener