1) cast variables to their own type; 2) print warning info if no corresponding lua callback function instead of crash;
Merge pull request #2824 from edwardzhou/master

Cast variables to their own type, and print warning info if no corresponding lua callback function instead of crash