Search found 520 matches
- 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: 9028
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...
- Fri Oct 20, 2023 12:18 am
- Forum: Support and Development
- Topic: How do I make a value absolute?
- Replies: 5
- Views: 3065
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:
However, if you mean something like a constant value, ie. a value that can not be changed, that's a bit more complicated topic.
Code: Select all
local value = -2
value = math.abs(value)
print(value) -- prints 2
- 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: 7463
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...
- 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: 6507
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...
- 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: 956
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.
- 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: 956
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...
- Thu Sep 14, 2023 3:59 pm
- Forum: Support and Development
- Topic: REQUESTING HELP
- Replies: 1
- Views: 355
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...
- 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: 547
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...
- 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: 620
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...
- Sun Aug 20, 2023 2:08 pm
- Forum: Support and Development
- Topic: Get system language locale?
- Replies: 11
- Views: 2567
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.