How to make a game with LOVE?
Re: How to make a game with LOVE?
It makes you a bad person.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Re: How to make a game with LOVE?
+1.kikito wrote:Yet.Karai17 wrote:Tables can also have functions and tables as keys. But don't do that.
I'm using functions as keys in reverse tables (see PiL for reference) to save functions' bindings to GUI controls in text files.
Re: How to make a game with LOVE?
You monster.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Re: How to make a game with LOVE?
How to do this better way then?
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: How to make a game with LOVE?
Don't listen to Karai17, he's being obtuse.
There's nothing inherently wrong in using tables or functions as keys. It's just a bit advanced, and it's preferable to learn the basics well first.
There's nothing inherently wrong in using tables or functions as keys. It's just a bit advanced, and it's preferable to learn the basics well first.
When I write def I mean function.
Re: How to make a game with LOVE?
Yeah, sorry, I am just being silly. As kikito said, there is nothing inherently wrong with it, but it is a very advanced activity.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Re: How to make a game with LOVE?
Never mind.
Actually functions as a tables' keys can be very useful:
(from http://stackoverflow.com/questions/1456 ... table-keys)
Not too difficult to use and can be very powerful imo.
Actually functions as a tables' keys can be very useful:
Code: Select all
fn1 = function(x) print(x) end
fn2 = function(x) print("bar") end
t[fn1] = "foo"
t[fn2] = "foo"
for i, v in pairs(t) do i(v) end
Not too difficult to use and can be very powerful imo.
Re: How to make a game with LOVE?
Weird.arampl wrote: Actually functions as a tables' keys can be very useful:
Code: Select all
fn1 = function(x) print(x) end fn2 = function(x) print("bar") end t[fn1] = "foo" t[fn2] = "foo" for i, v in pairs(t) do i(v) end
This code runs well. (t was undeclared, so I added t = {})
Looking at the 'for' cycle. v is undeclared, what is pairs?
UPD: Nevermind, found it out. http://www.lua.org/pil/4.3.5.html
.·˙·.·˙·.·˙·.·˙·.·˙·.·˙·.·˙·.·˙·.·˙·.·˙·.·˙·.·˙·.·˙·.·˙·.·˙·.·˙·.·˙·.·˙·.·˙·.·˙
Who is online
Users browsing this forum: No registered users and 4 guests