HEXAGÖN - A library for drawing hexagonal grids

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
Eldy
Prole
Posts: 4
Joined: Mon Oct 26, 2015 10:06 pm

HEXAGÖN - A library for drawing hexagonal grids

Post by Eldy » Fri Mar 15, 2019 2:19 pm

This is a small library that I wrote as a proof of concept for a project.

Basically everything is in the README.md file. It is not very developped, but I like to believe it has a solid foundation. Maybe it will be useful for someone else?

Check out the demo included in the repository!

https://github.com/olivier-grech/hexagon

keharriso
Prole
Posts: 45
Joined: Fri Nov 16, 2012 9:34 pm

Re: HEXAGÖN - A library for drawing hexagonal grids

Post by keharriso » Fri Mar 15, 2019 11:10 pm

Looks like a cool little library. You should really look into using local variables, though. By default, Lua variables are global, even inside of functions. It looks like your helper functions (toHexagonCoordinatesHorizontal, toHexagonCoordinatesVertical, distanceBetween) are also global. You might want to make them local and stick them at the top.
LÖVE-Nuklear - a lightweight immediate mode GUI for LÖVE games

User avatar
Eldy
Prole
Posts: 4
Joined: Mon Oct 26, 2015 10:06 pm

Re: HEXAGÖN - A library for drawing hexagonal grids

Post by Eldy » Mon Mar 18, 2019 10:44 am

Thanks for your answer.

Is sticking

Code: Select all

local
in front of the variable/function enough, or is there something else I should be aware of?

keharriso
Prole
Posts: 45
Joined: Fri Nov 16, 2012 9:34 pm

Re: HEXAGÖN - A library for drawing hexagonal grids

Post by keharriso » Mon Mar 18, 2019 1:47 pm

Eldy wrote:
Mon Mar 18, 2019 10:44 am
Thanks for your answer.

Is sticking

Code: Select all

local
in front of the variable/function enough, or is there something else I should be aware of?

Code: Select all

local
is all you should need.
LÖVE-Nuklear - a lightweight immediate mode GUI for LÖVE games

User avatar
Eldy
Prole
Posts: 4
Joined: Mon Oct 26, 2015 10:06 pm

Re: HEXAGÖN - A library for drawing hexagonal grids

Post by Eldy » Tue Mar 19, 2019 3:43 pm

I have taken your remarks into account.

keharriso
Prole
Posts: 45
Joined: Fri Nov 16, 2012 9:34 pm

Re: HEXAGÖN - A library for drawing hexagonal grids

Post by keharriso » Tue Mar 19, 2019 5:10 pm

There's still:
  • offset
  • xA
  • xB
  • xC
  • yA
  • yB
  • yC
  • distanceToA
  • distanceToB
  • distanceToC
  • hexagonA
  • hexagonB
  • hexagonC
  • possibleHexagons
  • distances
  • closerHexagon
  • resultX
  • resultY
  • hx
  • hy
LÖVE-Nuklear - a lightweight immediate mode GUI for LÖVE games

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests