Added untested generateString; Fixed Lua 5.2 compatibility