Backport lua 5.2's string lib for critical bug fixes