# Redefining special characters as macros

I'd like to redefine some special characters as macros. Essentially, I want to tell lualatex to execute some user-defined commands whenever encountering some special characters, such as á, ḿ, etc.

I've found this solution. http://www.tex.ac.uk/FAQ-activechars.html

\catcode\z=\active
\def z{Yawn, I'm tired}%


Unfortunately I think it doesn't work for special characters. When I put á at where z is in the above code, I got the following error:

!Improper alphabetic constant.


Your á is not a single glyph but an a with a combining accent U+0301. With the proper glyph U+00E1 is works fine:
\documentclass{article}