I lost the howto on this and searched again. Apparently someone wrote one up on Lusternia forums.

http://forums.lusternia.com/index.php?showtopic=14128

Woot! Much easier to write code in Lua than in TF's odd macro language.