Fun with lua and functional programming