refactored checkLua