Search found 497 matches

by dusoft
Wed Oct 18, 2023 5:41 pm
Forum: Support and Development
Topic: Table insert name
Replies: 7
Views: 7954

Re: Table insert name

This is basic Lua. Did you search before posting?

Code: Select all

 
basic="search" 
tutorials={} 
tutorials[basic]=1
print (tutorials.search)
by dusoft
Tue Oct 10, 2023 10:23 am
Forum: Support and Development
Topic: Optimal way to track mouse-hover/touch over a tile position ?
Replies: 10
Views: 12206

Re: Optimal way to track mouse-hover/touch over a tile position ?

BrotSagtMist wrote: Tue Oct 10, 2023 12:11 am I does not depend.
Its two lines for less cpu usage. That is ALWAYS a profit.
Not adding it if you can is a harmful mindset.
You should be spanked.
I still beg to differ and call it a microoptimization. Sorry, not into spanking.
by dusoft
Mon Oct 09, 2023 1:20 pm
Forum: Support and Development
Topic: Optimal way to track mouse-hover/touch over a tile position ?
Replies: 10
Views: 12206

Re: Optimal way to track mouse-hover/touch over a tile position ?

Whaaat? How can you be so wasteful when the fix to pull it to almost zero cpu is just adding two lines? It depends on what's going on in the background. If zero to nothing, it does not matter. If nothing to something and it's not CPU intensive, it does not matter. Etc. until you actually hit some p...
by dusoft
Sun Oct 08, 2023 11:28 am
Forum: Support and Development
Topic: Optimal way to track mouse-hover/touch over a tile position ?
Replies: 10
Views: 12206

Re: Optimal way to track mouse-hover/touch over a tile position ?

BrotSagtMist wrote: Sat Oct 07, 2023 2:59 pm ^
Yea the check itself is fine.
But you can optimize how often it runs. Eg check if the mouse has actually moved before.
That sounds like microoptimization to me. This basic hover check is not CPU intensive at all.
by dusoft
Sun Oct 08, 2023 7:57 am
Forum: Support and Development
Topic: I have a question about how lua works in general
Replies: 8
Views: 7305

Re: I have a question about how lua works in general

https://www.lua.org/pil/16.html

See the explanation about colon functions here.
by dusoft
Mon Oct 02, 2023 10:07 pm
Forum: Support and Development
Topic: I'm making progress with my coin collection system, but I have a problem with destroying coins
Replies: 9
Views: 8397

Re: I'm making progress with my coin collection system, but I have a problem with destroying coins

Your issue was that you were looping over `coin` using `for` and `#coin` length. But with gaps, your table could contain index 7, but the length would be e.g. just 5. So you would never come to coin index 7. I recommend using pairs to iterate. You former buggy code (main.lua, line 73): for i = 1, #c...
by dusoft
Mon Oct 02, 2023 9:43 pm
Forum: General
Topic: Scalable Approaches to Collision Resolution.
Replies: 6
Views: 12614

Re: Scalable Approaches to Collision Resolution.

The subtraction was just an example for demonstration's sake, my actual game's callbacks are much more involved. Indeed, but the order of applying damages is really up to you and your model. By "universal" callback do you mean something like this approach? function collide(object, other) ...