Search found 510 matches

by MrFariator
Wed Oct 25, 2023 10:41 pm
Forum: Support and Development
Topic: Copying a file from a local directory to the LOVE save directory
Replies: 2
Views: 8902

Re: Copying a file from a local directory to the LOVE save directory

You could potentially use os.execute, and run some copy commands to transfer those files over. These commands may be platform specifc, like using robocopy on windows. This method may flash a command prompt on users' screens, but if you mean to do the file transfers as a one-time thing (eg. when firs...
by MrFariator
Fri Oct 20, 2023 12:18 am
Forum: Support and Development
Topic: How do I make a value absolute?
Replies: 5
Views: 2950

Re: How do I make a value absolute?

If you mean to take the absolute value of a number, the function you're looking for is math.abs:

Code: Select all

local value = -2
value = math.abs(value)
print(value) -- prints 2
However, if you mean something like a constant value, ie. a value that can not be changed, that's a bit more complicated topic.
by MrFariator
Sun Oct 08, 2023 4:01 pm
Forum: Support and Development
Topic: I have a question about how lua works in general
Replies: 8
Views: 7305

Re: I have a question about how lua works in general

Well, as the error warns you, you can not index a function. To illustrate it, consider this minimum example: local function myFunction() end -- an empty function that does nothing myFunction() -- ok myFunction.someValue() -- error, can not index a function The same goes for situations, like trying t...
by MrFariator
Sat Sep 23, 2023 2:21 am
Forum: General
Topic: I just accidentally found a literal zip bomb for the ram in love
Replies: 3
Views: 6252

Re: I just accidentally found a literal zip bomb for the ram in love

While it's surprising that your example creates so much garbage, it's not also not particularly special, now is it? There are many ways to fill up RAM (excessive table creation, loading a bunch of assets into memory), force heavy CPU loads (just modifying love.run slightly could do), or cause excess...
by MrFariator
Tue Sep 19, 2023 12:09 am
Forum: Support and Development
Topic: Need help understanding bump.lua and also why my bullets act this way
Replies: 3
Views: 922

Re: Need help understanding bump.lua and also why my bullets act this way

Right, I think I intended to do that modification as well (either doing what you did, or assigning to a local variable), but must've slipped my mind.
by MrFariator
Mon Sep 18, 2023 6:54 pm
Forum: Support and Development
Topic: Need help understanding bump.lua and also why my bullets act this way
Replies: 3
Views: 922

Re: Need help understanding bump.lua and also why my bullets act this way

I believe the issue stems from the following: for i, bulletToRemove in ipairs(bulletsToRemove) do world:remove(bulletToRemove) table.remove(activeBullets, bulletToRemove[i]) -- this line here end I'm reasonably sure bulletToRemove[ i ] will just evaluate to nil in this context, which means that tabl...
by MrFariator
Thu Sep 14, 2023 3:59 pm
Forum: Support and Development
Topic: REQUESTING HELP
Replies: 1
Views: 345

Re: REQUESTING HELP

Welcome to the forums. The issue is here: for i = 0, totalStars, 1 do stars [1] = { -- the "1" here is the problem r = love.math.random(0,255) / 255, g = love.math.random(0,255) / 255, b = love.math.random(0,255) / 255, a = love.math.random(0,255) / 255, x = love.math.random(0, love.graphi...
by MrFariator
Sat Aug 26, 2023 2:25 pm
Forum: Support and Development
Topic: Having trouble with bump when different objects are on the screen
Replies: 2
Views: 525

Re: Having trouble with bump when different objects are on the screen

You are experiencing this behavior because you are using the world:check function, as opposed to the world:move function. -- change this... local actualX, actualY, cols, len = world:check(player, futureX, futureY) -- to this local actualX, actualY, cols, len = world:move(player, futureX, futureY) As...
by MrFariator
Tue Aug 22, 2023 4:24 pm
Forum: Support and Development
Topic: I'm having trouble understanding filtering collisions in bump.lua
Replies: 2
Views: 595

Re: I'm having trouble understanding filtering collisions in bump.lua

All the filters boil down to is that for each collider that you want to update, you provide a function. This function takes the currently updating collider, and the object it is colliding with as arguments. You can then resolve the collision based on the different objects' attributes or behavior (is...
by MrFariator
Sun Aug 20, 2023 2:08 pm
Forum: Support and Development
Topic: Get system language locale?
Replies: 11
Views: 2348

Re: Get system language locale?

A decent alternative is also to just ask users their preferred language when they launch your project, at least the first time. That leaves less room for ambiguity. Of course, this assumes you have localizations available for a given set of languages.