testing logic in pure lua