Search found 2311 matches

by pgimeno
Mon Sep 14, 2020 10:40 am
Forum: Support and Development
Topic: Getting a key as a number
Replies: 8
Views: 3735

Re: Getting a key as a number

Sorry, I should've added a use case. I want to do: if var[2] > 1 then ~other stuff Right now, that won't work, because var[2] is a table. I want to eval that "2" there, as a number. The 2 is a value itself. Taken at face value, the answer to your question is: if 2 > 1 then ~other stuff But I have t...
by pgimeno
Sun Sep 13, 2020 7:24 pm
Forum: Ports
Topic: Love.js - A Direct Emscripten Port
Replies: 171
Views: 163591

Re: Love.js - A Direct Emscripten Port

ivan wrote:
Sun Sep 13, 2020 5:53 pm

Code: Select all

Error: [string "boot.lua"]:530: conf.lua:21: attempt to index a nil value
What about showing what conf.lua line 21 does?
by pgimeno
Sun Sep 13, 2020 7:21 pm
Forum: Support and Development
Topic: Getting a key as a number
Replies: 8
Views: 3735

Re: Getting a key as a number

I don't understand the question either. Maybe he means something like ipairs()?

Code: Select all

for index, value in ipairs(var) do
  -- index is the number, value is the contents at that index
  print(index .. ": " .. value)
end
by pgimeno
Wed Sep 09, 2020 12:25 am
Forum: Support and Development
Topic: having trouble running slab!
Replies: 1
Views: 3644

Re: having trouble running slab!

Löve is a framework; it provides an API. Slab is designed to be used by programs that are made for Löve.

love.filesystem.read supports a second optional string argument starting in version 11.0. Maybe you're using an older version?
by pgimeno
Mon Sep 07, 2020 11:44 pm
Forum: Support and Development
Topic: I don't how to set up Love
Replies: 2
Views: 3685

Re: I don't how to set up Love

You don't run Lua, you run Love. Your Lua file must be called 'main.lua'. Note that Love requires a folder, not a file. You need to pass it the folder where 'main.lua' is located. Maybe this video helps: http://www.youtube.com/watch?v=ZQCky-_Ad5Y You can't choose the version of Lua that is run, it's...
by pgimeno
Sat Sep 05, 2020 8:21 pm
Forum: Support and Development
Topic: how to get the compass direction between two points ?
Replies: 11
Views: 5033

Re: how to get the compass direction between two points ?

For the result to underflow, both of the original coordinates need already be in the order of 1e-307 or less, otherwise the subtraction can't generate a denormal small enough to cause an underflow. Even forgetting that it's extremely unlikely to hit such numbers, they are so close together that they...
by pgimeno
Sat Sep 05, 2020 1:25 pm
Forum: Support and Development
Topic: how to get the compass direction between two points ?
Replies: 11
Views: 5033

Re: how to get the compass direction between two points ?

Yes, I believe 0.0 is safe here. Equality comparison is not trivial and needs to be examined case by case. In this case it is. That said, I would prefer to return an arbitrary angle here (like 0.0) rather than nil. Furthermore, I'm pretty sure that the big branching factor adds a performance penalty...
by pgimeno
Sat Sep 05, 2020 11:18 am
Forum: Support and Development
Topic: how to get the compass direction between two points ?
Replies: 11
Views: 5033

Re: how to get the compass direction between two points ?

atan2(p2.y, p2.x) - atan2(p1.y, p1.x) does not give you the angle of the line between p1 and p2. When you calculate the atan2 of a point, the result is the angle of that point with respect to (0, 0). The difference of two such atan2 has nothing to do with the angle between p1 and p2. http://www.form...
by pgimeno
Sat Sep 05, 2020 10:28 am
Forum: General
Topic: Love CPU usage
Replies: 39
Views: 17849

Re: Love CPU usage

RNavega wrote:
Sat Sep 05, 2020 8:06 am
I don't understand the confusion, timerStep() (alias for love.timer.step()) returns the time that's elapsed since the last call to it.
I was wrong. The confusion came from the fact that I missed that you were waiting for the sum of both, not for only one.
by pgimeno
Fri Sep 04, 2020 4:08 pm
Forum: Support and Development
Topic: how get matrix from image
Replies: 9
Views: 3014

Re: how get matrix from image

thanks, i will use the ffi pointer, it was what i was looking for. but another question arose, as the name says, it’s a pointer. but you use some functions there like the cast, is the imageBytes a copy by reference or by value? A pointer is a reference. If you modify the data pointed to by the poin...