I want to make a text editor in Love2D.

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
Lua Hal
Citizen
Posts: 58
Joined: Tue Jul 12, 2011 10:30 pm

I want to make a text editor in Love2D.

Post by Lua Hal »

Now that it has the ability to resize windows dynamically, I really want to make a text editor. I have enough knowledge to do it, but if there's anything you'd like to point out for help I'd love to hear it! I am particularly worried about editing long files - won't Lua load the entire file into memory if I use io.open? Thanks for any help.
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: I want to make a text editor in Love2D.

Post by Ranguna259 »

I suggest using the [wiki]love.thread[/wiki] module to load files.
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
User avatar
Lua Hal
Citizen
Posts: 58
Joined: Tue Jul 12, 2011 10:30 pm

Re: I want to make a text editor in Love2D.

Post by Lua Hal »

Thanks for that, I'll keep that in mind.
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: I want to make a text editor in Love2D.

Post by miko »

Lua Hal wrote:Now that it has the ability to resize windows dynamically, I really want to make a text editor. I have enough knowledge to do it, but if there's anything you'd like to point out for help I'd love to hear it! I am particularly worried about editing long files - won't Lua load the entire file into memory if I use io.open? Thanks for any help.
Sure it will load all the file. This is what most text editors do anyways (unfortunately). For really large files, you could use file:seek() and file:read(buffersize) to read the file partially. But if it fits in the memory, reading it all makes things simpler (searching, browsing, etc).
Also, saving files will be limited only to the user's data directory (i.e., you will not be able to save to any location).
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
User avatar
Lua Hal
Citizen
Posts: 58
Joined: Tue Jul 12, 2011 10:30 pm

Re: I want to make a text editor in Love2D.

Post by Lua Hal »

Ah, okay. I suppose I'll have to just use the regular io library then.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests