Learning Lua

Quick question…I read that Corona has limitted LUA syntax’s due to security reasons. Therefor would learning LUA normally be fine because the ‘security’ issues would be much more advanced stuff, or are there way less syntax’s supported by Corona and therefor I should only look into some Corona LUA Guide?

Sorry if this was posted before, I looked but couldn’t find an answer to my exact question. Also if you know of any really good guides feel free to share =] thanks in advance sorry for the trouble [import]uid: 77199 topic_id: 23127 reply_id: 323127[/import]

I know, for myself, studying LUA helped me tremendously!

www.lua.org [import]uid: 21331 topic_id: 23127 reply_id: 92473[/import]

You will not be hindered at all in learning the Lua “language” and syntax on Corona. However, access to some of the underlying operating system functions will be restricted within Corona. Still, it’s very unlikely that will affect you at all while learning Lua. [import]uid: 71767 topic_id: 23127 reply_id: 92482[/import]

When you consider languages, there are two parts:

  1. The language itself: The syntax, the flow controls and decision making.
  2. The library of routines available to the language.

For instance in C, a for loop is part of the syntax of the language, however the printf function is part of the C Library and not part of C itself.

For Lua it’s the same. For and while loops are part of the syntax other function calls are part of the various libraries.

Corona supports the language bits pretty well from what I can tell, and many of the core library functions are supported, but its the area where you may find things being different.

Learn Lua it will help!
[import]uid: 19626 topic_id: 23127 reply_id: 92485[/import]

Just to throw my 2 cents in here - I think learning Lua is a great idea and would not discourage you, however I feel like I should say it is by no means necessary or even “best” to learn Lua before diving into Corona.

I learned Corona/Lua together, from Corona resources and sample code - ultimately I think that saved me time early on.

Again, not trying to discourage you from learning Lua unrelated to Corona, just wanted to put it out there that it isn’t a prerequisite. (A lot of people think it is.)

Peach :slight_smile: [import]uid: 52491 topic_id: 23127 reply_id: 92530[/import]

First of all thank you very much for all the answers. But I think you all misunderstood me, I’m confused now. I’m sorry I probably wrote it wrong.

I’m going to learn LUA either way, what I was wondering is…ignoring corona, if I pick up a beginner’s LUA book and study it, by the time I’m done with that book will I have learned quite a few syntax’s that I cant even use in corona? Or are the only syntax’s that I cant use in corona much more advanced and it probably doesnt even concern me. What im ultimately saying is, should I get a LUA book more guided for corona (if there even is one) or any LUA book is fine and I wont be learning excess information on the subject (not that it’s bad, but if a quarter of the syntax’s I just learned aren’t useable in Corona…well I couldov used that time to get better at syntax’s that would improve my LUA for Corona). I’m sure I’ll probably never use LUA outside of Corona. Hope I’m making sense, either way thanks again for all your help and information.

I agree with your method Peach and fully intend to work on my project while studying LUA on the side. Hope everyone has a great weekend. Thanks again to all the answers. [import]uid: 77199 topic_id: 23127 reply_id: 92539[/import]

Let me try and re-express this.

Without knowing the book you’re talking about and what all stuff it covers, I’m guessing 75-80% will be directly usable with Corona SDK.

We know there are some Lua functions like “loadstring” and “dofile” (I think) are not available to Corona SDK. One can’t be allowed because of Apple’s requirements and the other is replaced by the “require” statement.

But how to write functions, build and manage tables, construct FOR and WHILE loops, assign variables, test for conditions, use some of the common libraries, like the math library will be 100% usable with Corona SDK.

Corona SDK has a lot of the core Lua libraries like for doing network connections to internet servers build in, but other things like parsing an XML file, not so much.

Without knowing which of these libraries your book is going to cover, its hard to sit here and say if you learn X from the book you will be able to use it if X happens to be one of those not-included libraries.

If the book is half language half libraries and you’re going to get 100% of the language and 50% of the libraries, then you will be able to use 75% of the book. But that’s 100% speculation because I don’t know the book.
[import]uid: 19626 topic_id: 23127 reply_id: 92607[/import]

@hatethinkingofnames

Here is the list of all the changes to Lua that are present in Corona. As you can see, the list is VERY short, and will likely not impact you at all as you learn Lua, no matter what resource you use to learn Lua.

http://developer.anscamobile.com/content/changes-lua

If you want to learn Lua first, read the excellent, free, online Lua tutorial written by one of the authors of Lua:

http://www.lua.org/pil/p1.html

This will give you a really solid foundation in learning Lua 5.0. After you’re done that, and it won’t take long, learn about the small differences between Lua 5.0 and Lua 5.1, which is what Corona uses:

http://www.lua.org/manual/5.1/manual.html#7

I know that Peach recommends learning Corona and Lua together, and that’s fine if you want to get some rapid code out the door, but in my opinion that approach will not give you as solid of an underpinning of how to program “properly” in Lua. People who take this approach often seem to post really horrendous examples of coding style on the forums here, and I have to admit that even the official Corona SDK looks like it was programmed by someone who could use a refresher course on the basics of good software design. [import]uid: 71767 topic_id: 23127 reply_id: 92616[/import]