Search found 3707 matches

by pgimeno
Tue Mar 18, 2025 6:49 pm
Forum: Support and Development
Topic: Tilemap drawing issues
Replies: 2
Views: 679

Re: Tilemap drawing issues

I tried, but stumbled on some errors when I attempted to make up some assets in order to run and debug it. If you can provide a fully runnable program with just enough assets as for it to run (the assets can be just placeholders, they don't need to be your original assets), that would help me help y...
by pgimeno
Wed Mar 12, 2025 7:00 pm
Forum: Ports
Topic: So love.js doesn't support goto?
Replies: 3
Views: 1043

Re: So love.js doesn't support goto?

goto is a Lua 5.2 thing, and LuaJIT implements it as an extension . However, love.js can't run LuaJIT and runs PUC Lua 5.1 instead, as far as I know, so I'm afraid you're out of luck. You can always try to compile your own PUC Lua 5.1 backporting the goto extension from 5.2, but I guess that's not a...
by pgimeno
Sat Mar 08, 2025 10:34 am
Forum: Support and Development
Topic: How to determine if a value is a LÖVE object?
Replies: 5
Views: 757

Re: How to determine if a value is a LÖVE object?

I was thinking something not too different from what zorg has posted. zorg's code has some bugs and some redundancy, though. - The first two lines should be swapped, otherwise you would always need to pass a string as the second parameter and the second line would be redundant. - The line `if not x ...
by pgimeno
Wed Feb 26, 2025 7:10 pm
Forum: Support and Development
Topic: [Solved] Simple question about lua variable declaration.
Replies: 12
Views: 1855

Re: Simple question about lua variable declaration.

Thanks for the answer! Then, does the value of local variable stored in memory in a scope get freed when code exits the scope? Yes, but in the case of simple values (numbers, true, false, nil and the weird lightuserdata type), the allocation happens in the Lua stack, not in the heap. This makes the...
by pgimeno
Wed Feb 26, 2025 6:55 pm
Forum: Support and Development
Topic: [Solved] Simple question about lua variable declaration.
Replies: 12
Views: 1855

Re: Simple question about lua variable declaration.

I usually code like (2), because I thought every function call(or every loop) declares local variable and create garbages. However, I mostly see (1) in others' codes. So I started to think I've been misunderstanding this. Is (1) essentially same with (2)? It's not right that local variables create ...
by pgimeno
Mon Feb 24, 2025 11:09 am
Forum: Support and Development
Topic: I need help on FPS management
Replies: 6
Views: 1541

Re: I need help on FPS management

Deterministic physics is a desirable property - I can't help remembering the test that grump proposed: https://love2d.org/forums/viewtopic.php?p=245468#p245468 But it's not always necessary, and all the OP was asking is how to deal with high dt values (aka lag spikes). For that simpler goal, capping...
by pgimeno
Fri Feb 21, 2025 11:00 pm
Forum: Support and Development
Topic: Drawing image with origin offset based on polygon shape - a bit of mismatch
Replies: 6
Views: 2923

Re: Drawing image with origin offset based on polygon shape - a bit of mismatch

By the way, here's how to actually calculate the centroid of a polygon:

https://en.wikipedia.org/wiki/Centroid#Of_a_polygon

What I fail to understand, however, is why not to use Body:getPosition().
by pgimeno
Wed Feb 19, 2025 12:54 am
Forum: Support and Development
Topic: Attempting to add visible and invisible and made everything invisible
Replies: 5
Views: 2108

Re: Attempting to add visible and invisible and made everything invisible

No problem, I think it's been a misunderstanding and I have to apologize too. I just didn't exactly understand what you had tried. Well, I ran your program after adding a print(object.visible) debug line and the result was nil all the time. So I went on to check where was that 'visible' property def...
by pgimeno
Tue Feb 18, 2025 9:30 pm
Forum: Support and Development
Topic: Attempting to add visible and invisible and made everything invisible
Replies: 5
Views: 2108

Re: Attempting to add visible and invisible and made everything invisible

Thank you for informing me that ~= is equivalent to not equal to. However the problem I described was having that line never return true, which is a problem because I have some objects visible as 1 and others as 0 which should cause the visible objects to be drawn and the invisible objects to not? ...