Decoding Base64

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
AeroMcFly
Prole
Posts: 2
Joined: Thu Dec 22, 2011 9:21 pm
Location: Ohio, United States

Decoding Base64

Post by AeroMcFly »

First of all, I'm very new to Love2D. Very novice programmer. Currently using Love2D 0.8.0

I was just wondering, once you save a file encoded in Base64, how do you load that back and decode it?

Code: Select all

love.filesystem.setIdentity("DataTest")

newData = love.filesystem.newFileData("TEST","test.txt","base64")
love.filesystem.write("test.txt",newData)

local loaded = love.filesystem.read("test.txt") -- Problem
Marked "problem," it seems to not decode it back to 'TEST.' Does anyone know how to do this?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Decoding Base64

Post by Robin »

Firstly, it doesn't work like you think it works. love.filesystem.newFileData decodes the first argument using Base64 if you specify it. So "TEST" becomes "LD�" in plain text. AFAIK, LÖVE provides no method to encode to Base64.

Secondly, I'm curious, why do you want to use Base64?
Help us help you: attach a .love.
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Decoding Base64

Post by miko »

AeroMcFly wrote: I was just wondering, once you save a file encoded in Base64, how do you load that back and decode it?
Googling for "lua base64" yields this, which you can use in your project.
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Decoding Base64

Post by vrld »

I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
AeroMcFly
Prole
Posts: 2
Joined: Thu Dec 22, 2011 9:21 pm
Location: Ohio, United States

Re: Decoding Base64

Post by AeroMcFly »

Thanks guys
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests