Search found 151 matches

by MrFariator
Wed May 27, 2020 1:11 am
Forum: Support and Development
Topic: How to use "self" properly?
Replies: 6
Views: 160

Re: How to use "self" properly?

Consider the following for illustration purposes: local myTable = {} function myTable.myFunc ( self ) -- note the use of ".", note that in a situation like this 'self' is just a convention print ( self == myTable ) -- prints true end -- is equivalent to local myTable = {} function myTable:myFunc ( )...
by MrFariator
Wed May 20, 2020 5:32 pm
Forum: Support and Development
Topic: attempt to index field 'graphics' (a nil value)
Replies: 3
Views: 128

Re: attempt to index field 'graphics' (a nil value)

It is possible to access data contained in variables across multiple scripts. However, consider the following: -- in script1.lua myVariable1 = 1 -- 'local' keyword is not used; the variable is now a global local myVariable2 = 2 -- in script2.lua print(myVariable1) -- prints 1 print(myVariable2) -- p...
by MrFariator
Mon May 18, 2020 5:43 pm
Forum: Support and Development
Topic: bad argument #2 to 'newSource' (string expected, got no value)
Replies: 3
Views: 166

Re: bad argument #2 to 'newSource' (string expected, got no value)

In the past, love.audio.newSource allowed the second parameter, type, to be optionally omitted, and default to "stream". Nowdays you have to specify the type of the source, so all you need to do is gSounds = { ['paddle-hit'] = love.audio.newSource('sounds/paddle_hit.wav', 'static') -- or ['paddle-hi...
by MrFariator
Mon May 18, 2020 3:51 pm
Forum: Support and Development
Topic: Patch management - best practice
Replies: 1
Views: 124

Re: Patch management - best practice

May not be the best approach, but one idea I thought of while thinking about the same issue was to install patches within the user's save directory for the game. If you set the " appendidentity " field to false in conf.lua or so, love.filesystem will look into the save directory first before the sou...
by MrFariator
Mon May 11, 2020 7:28 pm
Forum: Support and Development
Topic: love.filesystem.getDirectoryItems("SimpleElementSystem.Systems")
Replies: 2
Views: 192

Re: love.filesystem.getDirectoryItems("SimpleElementSystem.Systems")

As far as I know, love.filesystem paths are in the format of path/to/file only, so path.to.file doesn't work. You may also want to be mindful of the exact casing on folder and file names; for example running code on Windows works fine if you mix the cases, but will fail when running from a .love or ...
by MrFariator
Thu May 07, 2020 8:44 am
Forum: General
Topic: A compile to Lua language for love2D ?
Replies: 4
Views: 414

Re: A compile to Lua language for love2D ?

Just in case you aren't aware, that sounds mighty bit like moonscript, and some people do use it for their love2d projects.
by MrFariator
Tue May 05, 2020 5:43 pm
Forum: Support and Development
Topic: love.draw() seems to ignore if statements
Replies: 3
Views: 334

Re: love.draw() seems to ignore if statements

Because you've never defined what the variables "line" and "point" are, this is effectively what's happening: function love.load() mode = nil -- ... end function love.draw() if mode == nil then -- because mode IS nil, this will be run every time love.draw is called end end Lua treats undeclared vari...
by MrFariator
Tue May 05, 2020 12:59 pm
Forum: Support and Development
Topic: Finding the intersecting point of two lines
Replies: 3
Views: 290

Re: Finding the intersecting point of two lines

On the love2d wiki there is a general math page, and it contains the following function: -- Checks if two lines intersect (or line segments if seg is true) -- Lines are given as four numbers (two coordinates) function math.findIntersect(l1p1x,l1p1y, l1p2x,l1p2y, l2p1x,l2p1y, l2p2x,l2p2y, seg1, seg2)...
by MrFariator
Fri May 01, 2020 11:17 am
Forum: Support and Development
Topic: Question regarding game distribution
Replies: 1
Views: 198

Re: Question regarding game distribution

The -y option is referring to the options you can pass to the zipping tool in macOS command line . Specifically, that option retains the symbolic links that may be present in the folder that you are to trying to archive into a zip. They are similar to Windows' "shortcut" icons, but unlike Windows' s...
by MrFariator
Thu Apr 30, 2020 8:52 pm
Forum: Support and Development
Topic: IPairs and tables
Replies: 7
Views: 395

Re: IPairs and tables

What does spritecomponent('Assets/lovie_modern.png') return? According to your original error, what you are passing to ipairs() is a nil value (ie. in your case playerComponents does not have a defined value). As such, spritecomponent() seems to be returning nothing for addPlayer() to use.