New to LUA

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
never
Prole
Posts: 10
Joined: Sun Apr 11, 2010 4:20 am

New to LUA

Post by never »

Hi, My name is Ryne. I'm interested in learning LUA and creating a project using the Love Engine, and I was wondering where I should start or if anyone had any useful links to tutorials.

I also had a few questions. I have always had an idea to create an Isometric RTS game similar to the "Proto-RTS" project by Geti (http://love2d.org/forum/viewtopic.php?f=5&t=1161). If I could create something like that it would be incredible. I'm new to LUA and programming in general so I'm probably getting ahead of myself, but I was wondering where I should start in terms of driving towards a project like that, with a similar Isometric style. I also find it confusing when I think about using Love. The way I see it is that "LUA" is a programming language all on its own, and Love is just an engine that uses LUA as its base programming language, but from the tutorials ive read and the tests that I've done it seems that you don't code for Love, as you would just a regular LUA application. Things are different. So I'm wondering if I should learn LUA first, instead of learning both LUA and LOVE at the same time to avoid confusion. Unless I'm thinking of it all wrong and someone would like to clarify?
User avatar
Thursdaybloom
Citizen
Posts: 81
Joined: Mon Feb 15, 2010 3:43 am
Location: Australia

Re: New to LUA

Post by Thursdaybloom »

Welcome to the forums Ryne/never. I'm also new to Lua and Love with no previous coding experience. I don't believe there is a 'wrong' way to learn, so if you think learning more Lua would help when using Love then go for it. Do what is is that makes it easier for you. Personally I prefer jumping straight into Love and actually using it to assist me in learning Lua. I find it much more rewarding and motivating to have visible success. So if you're the same then start using Love straight away. It's up to you.

I recommend the Hamster Ball tutorial to begin with. It helps you understand the primary Love functions, which may be the differences between Lua and Love that you find confusing. Love is a library aimed at aiding game design, not a complete 'engine' that 'builds the game for you'. The additional functions included in the Love library all begin with love. - so if you're using love.load(), love.keypressed(key) or any other that begins with love then you're accessing part of the Love library. Throughout the whole process you're writing in Lua. Don't think of Love as a confusing blend of two languages, but as a collection of helpful pre-written tools that you access using Lua.

Regarding isometric games, I recommend after you work on the Hamster Ball tutorial you try the Tile-Scrolling tutorials. Once you're happy with setting up 2d-arrays and placing tiles then try the Isometric Tutorial. This tutorial uses similar techniques but introduces the maths needed to place tiles in an isometric pattern. I have an old file suitable for that tutorial which I'll convert to 0.6 and upload for you when I can.

From there it's up to you. Just frequent the forums or IRC and don't hesitate to ask for help. Everyone here is LÖVELY and always willing to help (pun completely intended).



edit: included the isometric file
Attachments
isometric_graphics_tutorial_0.6.love
isometric tutorial 0.6
(2.85 KiB) Downloaded 156 times
never
Prole
Posts: 10
Joined: Sun Apr 11, 2010 4:20 am

Re: New to LUA

Post by never »

Thank you so much, I really appreciate the quick reply and the help. It's great to be able to ask a question and it actually be answered in such an organized and helpful way. Also thanks or that upload, I'm about to go to sleep but I'll dive right into it tomorrow, I'm sure it will be helpful. :megagrin:
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: New to LUA

Post by kikito »

I personally found that learning Lua (it's not written in all uppercases, as far as I know) helped me understand and learn how things work in LÖVE.

However, contrarily to you, I'm not new to programming in general - quite the opposite, in fact. So my experience learning will be quite different from yours. Let me tell you how was it anyway.

The most widely used "Lua learning book" is called Programming In Lua (usually refered to as PiL). It is freely available on the internet, on that link. I found it very useful for learning Lua. Most of the Part I should be easy to follow (except maybe the Coroutines). It should help you learn the basic syntax and concepts. Part II is more advanced, and you might struggle with it if you don't have prior programming experience. But it really depends on you. You will only need chapters 18 and 19 from part III, since the rest of the part treats things that work differently in LÖVE. You don't need anything from part IV.

Secondly, I found the Lua-users wiki very useful, specially their string recipes page. It might be a bit too advanced for you from now. But I had to mention it.

At any time you can ask any doubt you have on this forum. The chaps here will help you. I recommend using the search function on the top first; there's a significant chance that your question has already been asked before.

If you are into it, you can use the IRC, too. It's not my cup of tea; I favour the forum, so others can benefit from the answers I receive.

Now, about the differences between the "default Lua" and "the Lua used in LÖVE", here's a list from the top of my head:
  • Lua's print function is deactivated on windows. In order to activate it, you have to activate the console flag on your config file.
  • Lua's require function has been changed a bit - the "file lookup rules" are different from the default lua ones.
  • The file read / write functions have been "sandboxed". This means that you can't read/write on every file on your computer; instead, LÖVE limits your access to a very limited set of directories. This is done in order to prevent malicious software (i.e. viruses) and also to standarize the path where config files are saved in all games.
  • In LÖVE you have, obviously, all the objects and functions provided by the love.* package, which is not available on the default Lua.
That's all the differences I know. I believe that they look and feel very similar.

Welcome, and good luck!
When I write def I mean function.
never
Prole
Posts: 10
Joined: Sun Apr 11, 2010 4:20 am

Re: New to LUA

Post by never »

Thanks again for the reply. I was having trouble finding solid tutorials but the one you linked seems great, thanks a lot! :)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 2 guests