So maybe lets make this code to use prog-mode on Emacs >= 24, and fundamental-mode otherwise. The solution is to use *mode* which is available in Emacs 23, and inherits from *prog-mode* in Emacs 24, or use alias, like lua-mode does:

    (defalias 'lua--prog-mode
       (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))

It would be helpful for those who migrate to Emacs 24, since prog-mode delivers universal hook for "prog derived modes"