Fixed lua problems and added randomdbl.

Fixed return of lua functions (0 for 1).