Search found 516 matches
- Fri Dec 01, 2023 2:03 am
- Forum: Support and Development
- Topic: [SOLVED] I'm confused, Is a bug of 'repeat until'?
- Replies: 8
- Views: 3871
Re: I'm confused, Is a bug of 'repeat until'?
I explained what the issue in your code is, and how to address it. However, I'd recommend taking a step back, and trying to understand your table accesses. That's the root of your issues.
- Fri Dec 01, 2023 1:51 am
- Forum: Support and Development
- Topic: [SOLVED] I'm confused, Is a bug of 'repeat until'?
- Replies: 8
- Views: 3871
Re: I'm confused, Is a bug of 'repeat until'?
The contents of your uploaded main.lua do not match the code in your opening post, since you replaced the repeat-until with a goto, but... local queue = { { 1 } } local bananas = { 'got nil?' } function func(o) love.graphics.print(o[1]) end -- inside the loop for _, o in pairs(queue) do func(bananas...
- Fri Dec 01, 2023 1:31 am
- Forum: Support and Development
- Topic: [SOLVED] I'm confused, Is a bug of 'repeat until'?
- Replies: 8
- Views: 3871
Re: I'm confused, Is a bug of 'repeat until'?
Okay, I'll take just this snippet, and step you through it: local i = 1 repeat if queue[i] then for _, o in pairs(queue[i]) do o:func(bananas[i]) end end i = i + 1 if i < (999 + 1) then bananas[i * i / i] = nil end until(i > 5) 1. The code starts a repeat-until loop, ok. 2. If queue table at index i...
- Tue Nov 28, 2023 10:44 pm
- Forum: Support and Development
- Topic: table in love.event.push will lose metatable
- Replies: 3
- Views: 1880
Re: table in love.event.push will lose metatable
Can you share some code, to illustrate the problem you are having? The part about losing the metatable in the process sounds odd. Do remember that the colon(:) syntax is just syntactical sugar: myObject:myFunction(arg1) -- is the same as myObject.myFunction(myObject,arg1) function myObject:myFunctio...
- Fri Nov 24, 2023 4:07 pm
- Forum: Support and Development
- Topic: Creating an exact copy of an object
- Replies: 4
- Views: 2892
Re: Creating an exact copy of an object
The function I already posted handles deep copies, but it's not the only implementation to do so. The main caveat is that it may not work on tables that have any sort of special metatables going on, or extremely deep tables. However, based on the roblox docs, I believe Kopelat might just need to loo...
- Tue Nov 21, 2023 9:29 pm
- Forum: Support and Development
- Topic: Creating an exact copy of an object
- Replies: 4
- Views: 2892
Re: Creating an exact copy of an object
There are clone functions for a couple of specific types of things in löve, like Source:clone for audio sources. However, based on what I can surmise from Roblox documentation , you're asking for a method to create copies of lua objects. There is no readily available built-in functionality for this,...
- Sun Nov 19, 2023 2:33 pm
- Forum: Games and Creations
- Topic: Gravity Circuit
- Replies: 14
- Views: 13715
Re: Gravity Circuit
Thanks for the heads up, I don't actively use macOS, so I didn't quite realize that issue with the threads (truth be told, the threading is some ancient legacy code that could use an overhaul). I was turning JIT off on MacOS on the main thread, due to some potential luajit issues . Will look at addi...
- Sun Nov 19, 2023 2:17 pm
- Forum: Support and Development
- Topic: [solved] Animation - For Limit Must Be A Number
- Replies: 10
- Views: 10420
Re: Animation - For Limit Must Be A Number
In lua, # is the length operator. It returns the length of a string or table. I recommend looking up what the reserved keywords and operators are. PIL (the manual I linked) is a good resource to read through if you want to learn lua.
- Mon Nov 13, 2023 2:22 am
- Forum: Support and Development
- Topic: Adjusting hitboxes using bounce
- Replies: 6
- Views: 4036
Re: Adjusting hitboxes using bounce
Ah, right. That's simply because you add the character to the world with this: world:add(player,player.x+1,player.y+1,player.width-2,player.height-2) But then you move the character with this: local goalX = player.x + (player.speed*player.xdir*dt) local goalY = player.y + (player.speed*player.ydir*d...
- Sun Nov 12, 2023 2:14 pm
- Forum: Support and Development
- Topic: Adjusting hitboxes using bounce
- Replies: 6
- Views: 4036
Re: Adjusting hitboxes using bounce
Can you provide a .love of your project? I believe I would need to see your project in action to properly diagnose what the problem is, because I don't see anything wrong with the bump code.