Avoid use of deprecated table.getn.

table.getn is deprecated function in Lua 5.1 left for compatibility
with 5.0, use # operator instead.

Also, fixed typo.
Merge pull request #182 from annulen/getn

Avoid use of deprecated table.getn.