Working Lua 5.2.2 formula