Search found 1775 matches

by pgimeno
Wed Sep 18, 2019 1:07 pm
Forum: Support and Development
Topic: a super fast AABB collision detection ( Minkowski Sums )
Replies: 3
Views: 48

Re: a super fast AABB collision detection ( Minkowski Sums )

Bump uses the closely related Minkowski difference method, both to detect and to resolve collisions.
by pgimeno
Wed Sep 18, 2019 1:03 pm
Forum: General
Topic: Concatenation and garbage
Replies: 2
Views: 37

Re: Concatenation and garbage

Fair enough. I've edited the statement to be more precise. The source code clearly gathers as many as possible without generating intermediate concatenated strings. https://www.lua.org/source/5.1/lvm.c.html#luaV_concat From the source of luaV_tostring (https://www.lua.org/source/5.1/lvm.c.html#luaV_...
by pgimeno
Wed Sep 18, 2019 11:32 am
Forum: General
Topic: Concatenation and garbage
Replies: 2
Views: 37

Concatenation and garbage

I wanted to share something that I've discovered about how Lua handles concatenation, which may be useful if you worry about writing optimized code. I noticed in the Lua manual that the concatenation operator is right associative. The operation itself is associative: you get the same result from ("a...
by pgimeno
Tue Sep 17, 2019 11:24 pm
Forum: Support and Development
Topic: is it necessary to "free" texture data / love.graphics.Image ?
Replies: 6
Views: 108

Re: is it necessary to "free" texture data / love.graphics.Image ?

I've found that in a similar situation, if I didn't force garbage collection, the memory grew and grew out of control until the memory was completely filled. My hypothesis is that, since Lua does not know the size of the underlying object, it doesn't care that there are many big ones waiting to be g...
by pgimeno
Tue Sep 17, 2019 9:37 am
Forum: Support and Development
Topic: Detecting Input Without Window Focus (Listen For Input In The Background)
Replies: 5
Views: 134

Re: Detecting Input Without Window Focus (Listen For Input In The Background)

The whole concept of focus is about where to send input events, isn't it? Imagine you are typing in an editor, then change window to a web form, and what you type in the web form is typed in the editor. [EDIT: Or that you press F1 for help in one application, and every other open application opens t...
by pgimeno
Mon Sep 16, 2019 11:37 am
Forum: Games and Creations
Topic: Chessboard
Replies: 15
Views: 2244

Re: Chessboard

Well done. Like I mentioned, the "standard" Lua way is to move your code in a module. Example of a stateless module: local lib = {} function lib.movePiece(board, from,to) .. end function lib.getPiece(board, position) .. end return lib Just a nitpick, this is not stateless in itself. The library is ...
by pgimeno
Sun Sep 15, 2019 7:49 pm
Forum: General
Topic: help with collisions
Replies: 19
Views: 875

Re: help with collisions

world:move gives you information about what object was collided. It returns several things, including the table that you passed to world:add; check the docs. If you include any information you want in that table, for example the terrain type, you can get it back when world:move detects a collision.
by pgimeno
Sat Sep 14, 2019 8:23 pm
Forum: Support and Development
Topic: Writing unit tests within love code
Replies: 9
Views: 1792

Re: Writing unit tests within love code

I wonder if you're using the right file and the right architecture. Wasn't it .dylib for Mac? Not sure about that, I may be outdated. 0x7F 0x45 0x4C 0x46 0x01 0x01 0x01 0x00 means ELF 32-bit little-endian; there doesn't seem to be anything wrong there if Mac can load 32-bit ELF shared libraries. EDI...
by pgimeno
Sat Sep 14, 2019 6:04 pm
Forum: Support and Development
Topic: Writing unit tests within love code
Replies: 9
Views: 1792

Re: Writing unit tests within love code

Is there a way to expose the various love functions? I know in this specific instance I could get around it by writing my own simplex noise lib and using that, but I figured this must be a problem people have come across before and hopefully there is a solution already out there. You can require lo...