Search found 14 matches
- Tue Dec 16, 2014 9:51 pm
- Forum: General
- Topic: A few questions from a Lua/Love2D newbie.
- Replies: 4
- Views: 3142
Re: A few questions from a Lua/Love2D newbie.
You can do ultra-simple OO with inheritance like this: class = {} class.add = function(self) return self.a+self.b end class.getClassname = function(self) return self.classname end class.new = function(self, params) local newInst = {}; newInst.a = params.a or 0; newInst.b = params.b or 0; newInst.cla...
- Sun Dec 14, 2014 4:16 am
- Forum: General
- Topic: How to debug LOVE?
- Replies: 7
- Views: 7388
Re: How to debug LOVE?
I'm trying to find a way to debug what I code, but the compiler errors blocks my game and I cannot understand what happened exactly, I've tried lovebird with the hope to add more information but it doesn't. Which are the common ways to debug with LOVE 2D? When I have trouble with compiler errors, I...
- Sun Dec 14, 2014 12:13 am
- Forum: General
- Topic: Help with filesystem?
- Replies: 10
- Views: 6013
Re: Help with filesystem?
You know what they say: no gloval, no loval.
- Thu Dec 11, 2014 9:54 pm
- Forum: General
- Topic: How to access main.lua's directory?
- Replies: 2
- Views: 2296
Re: How to access main.lua's directory?
Thank you, that's very handy! It's not quite what I need-- but I discovered that "" or "/" is the read path containing main.lua. Not what I would have guessed since "" or "/" is the write path for appdata. Still running into weird cases-- are folders created i...
- Thu Dec 11, 2014 8:18 pm
- Forum: General
- Topic: How to access main.lua's directory?
- Replies: 2
- Views: 2296
How to access main.lua's directory?
I was thinking it would be smart to set up an automated version control system, but I'm having trouble accessing the directory of my lua files. I've tried appdir, workingdir, savedir, and userdir. What I would like to make is something like love.quit = function() if _G.debugBuild then local baseDir ...
- Thu Dec 11, 2014 12:24 am
- Forum: General
- Topic: Any reason not to do your logic in love.draw?
- Replies: 6
- Views: 4305
Re: Any reason not to do your logic in love.draw?
Well, I'm doing things with a queue of drawables, each with its own :draw function-- so my main looks like client:getInput() client:output(game) game:think(love.timer.getMicroTime()) for i =1, #client.drawQueue do client.drawQueue[i]:draw() end Which seems like a fine way to do things organizational...
- Mon Dec 08, 2014 12:00 am
- Forum: General
- Topic: Any reason not to do your logic in love.draw?
- Replies: 6
- Views: 4305
Re: Any reason not to do your logic in love.draw?
Ah, thanks for the explanations.
- Sat Dec 06, 2014 5:44 pm
- Forum: General
- Topic: Any reason not to do your logic in love.draw?
- Replies: 6
- Views: 4305
Any reason not to do your logic in love.draw?
I've just been handling logic inside love.draw (well, in objects' methods that get called by love.draw), then spent some time browsing the wiki and discovered love.update. Both get called every frame-- is there a reason to separate these? Am I doing something wrong? Is there some reason that love.up...
- Mon Nov 24, 2014 8:00 pm
- Forum: General
- Topic: Help with filesystem?
- Replies: 10
- Views: 6013
Re: Help with filesystem?
Thank you very much, that's working great!
- Sun Nov 23, 2014 7:27 pm
- Forum: General
- Topic: Help with filesystem?
- Replies: 10
- Views: 6013
Help with filesystem?
I know this is dumb, but... How can I most simply create a text file if it doesn't exist, then append a line of text, then close it? I'm trying to create simple output to a textfile (for debugging purposes, mostly). I would like to have something like, i, emergencyBrake = 0, 10^10 while table.contin...