This is my solution to Programming in Lua, third version