Add base64 encoding and decoding to the lua api. (#3919)