Page 1 of 1
I want to make a text editor in Love2D.
Posted: Sat Jun 07, 2014 2:26 pm
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.
Re: I want to make a text editor in Love2D.
Posted: Sat Jun 07, 2014 2:42 pm
by Ranguna259
I suggest using the [wiki]love.thread[/wiki] module to load files.
Re: I want to make a text editor in Love2D.
Posted: Sat Jun 07, 2014 2:47 pm
by Lua Hal
Thanks for that, I'll keep that in mind.
Re: I want to make a text editor in Love2D.
Posted: Sat Jun 07, 2014 8:00 pm
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).
Re: I want to make a text editor in Love2D.
Posted: Sat Jun 07, 2014 10:14 pm
by Lua Hal
Ah, okay. I suppose I'll have to just use the regular io library then.