Rework to bool using a set of lookup tables as upvalues. Add test cases for to_bool.