Dao.find_all returns null or empty collection if no rows found?


#1

In this line

Shouldn’t we write
if not creds[1] then
instead of
if not creds then
?

I’m developing very similar plugin and noticed then I have to add “[1]” to make things work. I’ve tried to print returned value and this is something like “table…”, but if I add [1] then it’s null. So looks like “find_all” always returns non-null value. Just like in java: for collections if no entries are found you will return empty collection, not null.

I’ve checked master but this example is completely reworked there.


#2

Never mind, understood intention of this line right after asking the question :slight_smile: Looks like it covers the case when information can not be loaded (no db access or something like this).
Wanted to delete this post but have no permission.