Learn Lua / Love2D with me :)

Learn Lua / Love2D with me :)

Postby Julius » 15 Apr 2020, 00:38

So I decided that it might be nice to learn some lua. No lua doesn't suck: https://youtu.be/LvpDE5z2_XE

Both for simple game dev, but also because the popular XMPP server Prosody is written in lua and I am interested in developing extensions for it.

It seems fairly popular around here as well, especially in the form of Love2D: https://love2d.org
So if you want to help me or just join me in learning it, this is the place. Although a word of warning... I am probably going to be a lot slower than you as I suck :eew:

I'll probably start with this tutorial series: https://sheepolution.com/learn/book/contents

Maybe something from here is interesting as well: http://lua-users.org/wiki/TutorialDirectory

But the medium term goal is to revive this Love2D project and get it to a fun state:
https://github.com/poVoq/opencrypt
https://www.youtube.com/watch?v=_xzpXc8emBE

Or maybe I'll try some Godot project with this: https://github.com/perbone/luascript
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2974
Joined: 06 Dec 2009, 14:02

Re: Learn Lua / Love2D with me :)

Postby Julius » 15 Apr 2020, 01:01

Ok first step, get a nice IDE.

There is some discussion what to choose here:
https://love2d.org/forums/viewtopic.php?f=3&t=6915
And a awesome list here: https://github.com/love2d-community/awesome-love2d#ides

I'll probably go with the ATOM IDE: https://atom.io/packages/love-ide
But this looks also interesting: https://studio.zerobrane.com/
(because: http://notebook.kulchenko.com/zerobrane ... -with-love )
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2974
Joined: 06 Dec 2009, 14:02

Re: Learn Lua / Love2D with me :)

Postby Julius » 15 Apr 2020, 02:33

Not my cup of tea, but there is a video tutorial set:
https://www.youtube.com/playlist?list=P ... 9aT88KGxH8
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2974
Joined: 06 Dec 2009, 14:02

Re: Learn Lua / Love2D with me :)

Postby GunChleoc » 15 Apr 2020, 10:24

You could also look for an active FLOSS game that uses Lua and see if they have beginner's tickets to pick up. Off the top of my head, Wesnoth, Hedgewars, Widelands. There might be more.
User avatar
GunChleoc
 
Posts: 500
Joined: 20 Sep 2012, 22:45

Re: Learn Lua / Love2D with me :)

Postby Julius » 15 Apr 2020, 18:39

Yeah, that would be another good option of course.

For now I went with the Zerobrane IDE as that is what the tutorial uses and I never really got a "favorite" IDE anyways.

Made progress a few chapters in... the lua syntax is a bit unusual but quite easy to learn and remember I think.
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2974
Joined: 06 Dec 2009, 14:02

Re: Learn Lua / Love2D with me :)

Postby smcameron » 15 Apr 2020, 20:07

Space Nerds in Space could always use more mission scripts, which are written in Lua. Lua API for it is described here, and some existing scripts are here.
smcameron
 
Posts: 363
Joined: 29 Oct 2010, 23:44

Re: Learn Lua / Love2D with me :)

Postby Vandar » 16 Apr 2020, 16:15

I haven't installed an IDE yet, beyond the scite editor (a very generic text editor). The client in my latest project (Tiny Places in Showcase forum) uses Lua/Love2d for the client though. I found the Love2d online documentation to be very helpful. So I'm a newby myself, but feel free to ask if you are looking for help :)

Lua favors a style of OOP that is different from what I had been used to in C++ or Java, but I like the approach to use tables to combine data and function pointers a lot. Very easy, very flexible. Reminds me a bit of how Smalltalk did OOP, at least in the way that any object can implement any method and you can just try to call it regardless of the class of the object.
In soviet russia, code debugs you.
User avatar
Vandar
 
Posts: 318
Joined: 17 Mar 2014, 14:32

Re: Learn Lua / Love2D with me :)

Postby Julius » 16 Apr 2020, 22:49

Worked on something else today, but I am still very much committed to this.

Thanks for the suggestions and help offered :)
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2974
Joined: 06 Dec 2009, 14:02

Re: Learn Lua / Love2D with me :)

Postby GunChleoc » 17 Apr 2020, 17:54

There are 2 pitfalls around tables:

- Indexing starts at 1 instead of 0
- #table doesn't return the actual number of elements, but the highest index used. This can be misleading if you have gaps in the index.
User avatar
GunChleoc
 
Posts: 500
Joined: 20 Sep 2012, 22:45

Re: Learn Lua / Love2D with me :)

Postby Vandar » 18 Apr 2020, 23:11

GunChleoc {l Wrote}:T
- #table doesn't return the actual number of elements, but the highest index used. This can be misleading if you have gaps in the index.


Even worse. It returns the first index that is followed by a nil, even if there are more entries coming after the gap. My conclusion: do not use the size operator on tables, unless you are 100% sure there are no gaps.
In soviet russia, code debugs you.
User avatar
Vandar
 
Posts: 318
Joined: 17 Mar 2014, 14:32

Re: Learn Lua / Love2D with me :)

Postby Julius » 20 Apr 2020, 01:34

Good to know. But I actually like that indexing starts at 1 :p

Making slow progress with the tutorial, as I am getting distracted with other stuff. But so far so good :heart:
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2974
Joined: 06 Dec 2009, 14:02

Re: Learn Lua / Love2D with me :)

Postby GunChleoc » 21 Apr 2020, 17:34

Julius {l Wrote}:Good to know. But I actually like that indexing starts at 1 :p

That's fun until you try to do modular arithmetic on it. Those necessary index shifts by 1 are not fun.
User avatar
GunChleoc
 
Posts: 500
Joined: 20 Sep 2012, 22:45

Re: Learn Lua / Love2D with me :)

Postby Vandar » 22 Apr 2020, 14:38

It's a bit weird indeed. Some old BASIC dialects had an option to choose 0 or 1 as array start.

But can't you just insert elements manually and begin at zero?

{l Code}: {l Select All Code}
  array[0] = someValue
  array[1] = someOtherValue


should be totally legal.
In soviet russia, code debugs you.
User avatar
Vandar
 
Posts: 318
Joined: 17 Mar 2014, 14:32

Re: Learn Lua / Love2D with me :)

Postby GunChleoc » 22 Apr 2020, 18:40

Yes it should, but then you have to remember to do so every time, or write your own array access wrapper functions and use those.
User avatar
GunChleoc
 
Posts: 500
Joined: 20 Sep 2012, 22:45

Re: Learn Lua / Love2D with me :)

Postby Technopeasant » 26 Apr 2020, 02:55

Vandar {l Wrote}:It's a bit weird indeed. Some old BASIC dialects had an option to choose 0 or 1 as array start.


Yes, and Visual Basic .Net and Gambas are both 0 indexed as opposed to classic Visual Basic or QBasic.
User avatar
Technopeasant
 
Posts: 91
Joined: 22 Feb 2017, 03:38

Re: Learn Lua / Love2D with me :)

Postby Julius » 08 Jun 2020, 13:30

Sorry, got sidetracked with other stuff. Still planning to get back to this though.

Found this interesting engine that apparently is build on top of Love2D:
https://github.com/Planimeter/grid-sdk
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2974
Joined: 06 Dec 2009, 14:02

Re: Learn Lua / Love2D with me :)

Postby Julius » 01 Jul 2020, 19:20

http://tylerneylon.com/a/learn-lua/

Quick "learn lua in 15 minutes" summary.
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2974
Joined: 06 Dec 2009, 14:02

Re: Learn Lua / Love2D with me :)

Postby Julius » 06 Jul 2020, 15:45

Ahh, this looks cool:
https://github.com/a327ex/BYTEPATH
(LÖVE game with tutorial)
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2974
Joined: 06 Dec 2009, 14:02

Re: Learn Lua / Love2D with me :)

Postby Julius » 06 Jul 2020, 15:54

Ahh and this (with some plugins) might make for a cool code editor written in lua:
https://github.com/rxi/lite
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2974
Joined: 06 Dec 2009, 14:02

Re: Learn Lua / Love2D with me :)

Postby Julius » 22 Aug 2020, 00:32

“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2974
Joined: 06 Dec 2009, 14:02

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron