Clone from lua-5.2.2