Search found 20 matches

by Vrx8
Sat Sep 09, 2017 1:13 pm
Forum: General
Topic: get the key of the smallest value in a table ?
Replies: 13
Views: 7530

Re: get the key of the smallest value in a table ?

grump wrote: Sat Sep 09, 2017 1:06 pm There's an 'end' missing in Nixola's code.

Code: Select all

function returnMin(t)
  local k
  for i, v in pairs(t) do
    k = k or i
    if v < t[k] then k = i end -- end was missing here
  end
  return k
end
still not working for me.. idk why, but I found out my own way..
by Vrx8
Sat Sep 09, 2017 12:49 pm
Forum: General
Topic: get the key of the smallest value in a table ?
Replies: 13
Views: 7530

Re: get the key of the smallest value in a table ?

Nixola wrote: Sat Sep 09, 2017 12:32 pm Iterate over the whole table, keeping track of the lowest value.

Code: Select all

function returnMin(t)
  local k
  for i, v in pairs(t) do
    k = k or i
    if v < t[k] then k = i
  end
  return k
end
have you try it out ?
by Vrx8
Sat Sep 09, 2017 12:30 pm
Forum: General
Topic: get the key of the smallest value in a table ?
Replies: 13
Views: 7530

get the key of the smallest value in a table ?

confused.. the values in the table are constantly changing.. and i want to get the key of the smallest value in the table, how do i do it ? googled it out.. find nothing
by Vrx8
Tue Sep 05, 2017 9:48 am
Forum: General
Topic: release date for 0.11 ?
Replies: 4
Views: 3623

release date for 0.11 ?

any release date ?
by Vrx8
Mon Aug 07, 2017 9:16 am
Forum: General
Topic: How exactly should I learn
Replies: 18
Views: 21653

Re: How exactly should I learn

you dont have bad memories, memorizing stuff on new game engine is hard.. if you never make games before and the fact that you just started to learn programming, i think love2d is a bad engine to start with
by Vrx8
Sun Aug 06, 2017 2:30 pm
Forum: General
Topic: library similar to TLfres ?
Replies: 3
Views: 3861

Re: library similar to TLfres ?

Hello! I've made a basic one for my game on the Ludum Dare 39, maybe it fits your needs: https://www.dropbox.com/s/nyyvedut3u6vjp0/fixed-resolution.love?dl=0 Also please note that it was packaged for anoter Love2D member here, I hope you don't mind! If you download the .love file, you can rename it...
by Vrx8
Sat Aug 05, 2017 3:33 pm
Forum: General
Topic: library similar to TLfres ?
Replies: 3
Views: 3861

library similar to TLfres ?

it's a library for scaling and very useful for me, but it's already outdated, i found a similar library called simpleScale, but it is very buggy and never get any update, any other alternatives ?
by Vrx8
Mon Jul 24, 2017 4:11 am
Forum: General
Topic: get audio length ?
Replies: 3
Views: 2992

get audio length ?

how do i get length of an audio ? like 5 seconds.. 10 seconds
by Vrx8
Mon Jul 10, 2017 4:11 am
Forum: General
Topic: Scaling on mobile ?
Replies: 2
Views: 2153

Scaling on mobile ?

so.. for example.. the width of my pc is 1000 pixels.. and i make an android game in it, so if i want to make a rectangle with 250 pixels width (1/4 of the screen) and make it as big as 1/4 of my mobile phone's width.. i need to do this ? love.graphics.rectangle("fill", x, y, love.graphics...
by Vrx8
Sat Jun 17, 2017 5:43 am
Forum: General
Topic: remove physics object when colliding ?
Replies: 2
Views: 2167

remove physics object when colliding ?

i use world:setCallbacks to handle physics object collisions, so i want to remove an object when its colliding with other, any idea on how to do it ? need the most simple way..