I can't understand

I want to say first that I don’t want to start any argumentative thread here.

Why did Ansca pick Lua as the main language ? There are other languages that take even less memory, are easier to move between platforms. There are other languages that are object oriented, dare I say more powerful, bigger libraries, more knowledge and history.

I like Lua, but because if the way it is, my files usually end up in the thousands of lines, and thousands of lines are difficult to maintain and prevent bloat (unused variables f.ex).

I am only curious, to why Lua was picked, not Lua vs the world. The internet is full of those threads and people usually favor what they know. This is hopefully not one of those threads.
[import]uid: 61610 topic_id: 15765 reply_id: 315765[/import]

I can’t really answer why Ansca picked Lua. But its miles easier to use than Objective C.

I will add this: Lua makes for some bad programming habits for ECMAScript “C” based languages. This week while working on the online servers and web content for my next game, I found myself leaving off semi-colons, putting in “then”'s in my if statements and leaving off the parens around if statement tests. It’s not been the worst of all things, but its bad enough trying to write PHP code then work on Javascript (w/ jQuery) mixing in CSS and HTML to the fun.

I’m surprised they didn’t go with an ECMAScript based language, in particular to court Flash folk.

But I will say this: I’m a long time C guy. I used to measure how long it took me to learn a new language in hours. Then C came and basically purged all other languages from my head and I’ve had a very hard time learning any new language sense. Its why I like JavaScript and PHP. At their core they are still C. My dislike for Objective C is the smalltalk bits.

I’ve struggled trying to learn python and ruby. Even Blitz makes me scratch my head.

Lua on the other hand I picked up quickly and for the most part I can write it in my sleep now after 6 months. There is still a lot I don’t understand about the language, but I was comfortable with the language after a few days. I can’t say that about any other language I’ve used since my ‘C’ purge.
[import]uid: 19626 topic_id: 15765 reply_id: 58210[/import]

And your sugestion is? I work as front end and backend webdeveloper for years and in my opinion if you are experienced developer you need months to be efective ECMAScript 5/javascript and few weeks to be efective LUA developer. Its crazy easy to learn and understand best with javascript experience. [import]uid: 12704 topic_id: 15765 reply_id: 58230[/import]

I do not come from programming background, and have no formal engineering/computer science training – but I was able to pick up Lua fairly quickly. I find this extremely attractive. Coupled with Lua and the thriving and super friendly/helpful/generous community, I can only see Corona SDK not only attracting already super smart, experienced & ingenius engineers but also attracting & empowering broader group of creative minds. [import]uid: 67217 topic_id: 15765 reply_id: 58238[/import]

I think my point is that Lua is easy to learn. As @ask said, non-programmers pick it up quickly. As @gtatarkin said, ‘C’ based languages are hard to pick up.

Ergo: Lua is a great choice.
[import]uid: 19626 topic_id: 15765 reply_id: 58241[/import]

:slight_smile: and that is really wonderful in LUA or squirrel (BTW. common used languages in game development - World of Warcraft for example). ES5 is great but you need to have lots of experience to know what is really fast and clean in current case. ES5 is like estimate integrals in math - without 1000 solved math problems you’re still not good enough :slight_smile: [import]uid: 12704 topic_id: 15765 reply_id: 58243[/import]

@traustitj,
in short, well Ansca had to pick a language, some language and it was Lua, had it not been Lua, it could have been…

Why don’t you hear the stories from Carlos himself…

http://www.vimeo.com/ozapps/carlos1
http://www.vimeo.com/ozapps/carlos2
http://www.vimeo/28703766
cheers,

?:slight_smile: [import]uid: 3826 topic_id: 15765 reply_id: 58276[/import]


There are other languages that take even less memory, are easier to move between platforms.

I think you will be hard pressed to name a language that satisfies that statement while still being a language that people want to code in. The Lua core is about 100 kilobytes. It is written in ‘clean C’ with almost no dependency on the C standard library. Almost nobody does that. When some people talk about portability, they might rattle off two platforms like Windows and Linux on x86. When Lua talks about portability, they literally mean anything that has a C compiler.


more knowledge and history

Lua is actually a little bit older than Java. A large part of the community that uses Lua tend to be language enthusiasts that know a lot of different languages and have a good perspective of things. Lua wasn’t created in the dark.

I’m not speaking for why Corona picked Lua because I wasn’t there, but Lua is and has-been the de-facto ultimate game scripting language for over a decade now. (Grim Fandango from LucasArts, 1998, is the first known commercial game use.) The majority of commercial games use Lua as their scripting language, and there isn’t even a close second (second place is usually ‘invented own scripting language for game’).

The developer who spearheaded Lua for Grim Fandango (and Escape from Monkey Island) has spoken publicly how Lua was adopted by them and how he did the ‘impossible’ of replacing the old SCUMMVM engine and accidentally inspired the entire game industry to also adopt Lua. His presentations are worth reading/listening to.

Also, Psychonauts has been very well documented and is worth reading/listening to. They are fairly representative of how the game industry uses Lua. Stats: 260,000 lines of C++, 400,000 lines of Lua, team of over 40 people.

(Both presented at the first Lua Workshop in 2005 and you might be able to find their recorded audio presentations. Incidentally, the Workshop was held at Adobe and they were working on Lightroom which is also built using a ton of Lua.)

[import]uid: 7563 topic_id: 15765 reply_id: 58282[/import]

Hi Ewing,

Like I said in the beginning, I am just curious as Lua is pretty weird language, but it is easy to pick up and all that. But you have some very interesting points. Is the interview with the dude behind Grim Fandango available online somewhere ? And this Psychonauts ? [import]uid: 61610 topic_id: 15765 reply_id: 58315[/import]

I personally love Lua - I was able to learn it without any prior coding experience. (I knew maybe 4 HTML tags, at best.)

I could tell you why Lua was chosen, because being a big Carlos fan I listen to any podcast he shows up on :wink: If you are interested in why it was chosen I’d suggest you have a listen.

You can find links on his blog; http://www.carlosicaza.com/2011/08/01/podcasts/

Peach :slight_smile: [import]uid: 52491 topic_id: 15765 reply_id: 58349[/import]

LUA is not only easy to learn but also (relatively) easy to implement in a C environment, because the LUA API itself is written in C.

Every mobile OS has a C-Library – so using LUA kills several birds with one stone when it comes to cross platform development. [import]uid: 70635 topic_id: 15765 reply_id: 58352[/import]

Lua Workshop 2005 (slides and summaries)
http://www.lua.org/wshop05.html

Audio recording announcement for Lua Workshop 2005
http://lua-users.org/lists/lua-l/2006-01/msg00397.html

Updated download link:
http://lua.simmunity.com/

[import]uid: 7563 topic_id: 15765 reply_id: 58407[/import]

That your modules are 1000+ lines has what exactly to do with Lua? Poorly-factored code can be written in any language. [import]uid: 58455 topic_id: 15765 reply_id: 58859[/import]

For me, figuring out modules was one of the harder parts of the learning curve. Based on the frequency that questions are asked here, figuring out how to create modules and pass data between them is not as easy as other languages.

Of course once you figure that out, you have a “Doh!” moment.

My first game everything was in my main.lua file, over 4100 lines of code. Besides Lua files I got from others, I only had one lua file that kept my print_r function in it. With my last release, I added some new features and I was able to put those 175 lines in an external module.

Using Director or Scene manager helps you get past the one big file issue and is highly recommended that new users learn them asap. [import]uid: 19626 topic_id: 15765 reply_id: 58864[/import]

I don’t agree with the “easy to learn” argument: PHP and Javascript are easy to learn but ECMA compliant. The point is that if you have any experience in one of those languages, moving to Lua is easy. Similarly, if you’re brand new to programming, learning Lua is not going to be helpful when you want to move onto something else.

If it’s about being lightweight and therefore high performance then absolutely fine. No language is perfect after all. [import]uid: 95579 topic_id: 15765 reply_id: 65137[/import]

“easy to learn” has a bit of subjectivity to it, but there is a massive body of empirical evidence that Lua is indeed easy to learn. We have over a decade of the video game industry using it in commercial games. Typically the content designers (artists) are not programmers with little or no coding experience, yet collectively again and again, they manage to pump out amazing games. Money and success talks; the video game industry is a tens-of-billions of dollars per year industry now.

I recall Paul Du Bois (Psychonauts) stating he did not consider Lua experience to be important to see on a resume to be hired for content designers because Lua so easy to learn that it wasn’t an important skill to him and expected the people he wants to hire would be capable of picking up things.

In addition Lua is one of those rare languages that don’t always set off the huge religious language wars and resistance which antidotally seems to be the worst among C++ and Java developers in my personal experience. It has been my experience that it is very hard to get a pure C++ or Java programmer touch any other language. But I’ve seen Lua slip in under the radar of these people. I think the reason is two fold: 1) the language doesn’t threaten to replace their language; it cooperates with it, and 2) the syntax of Lua is simple enough and close enough to C that it doesn’t set off confusion and alarm bells (as might Perl with all the non-letter characters or Lisp/Scheme with the parenthesis, Obj-C with the brackets, Python with its significant whitespace, etc).

Also, at that first Lua workshop, a university instructor presented that he found Lua to be an ideal teaching language because it allows students to get at the heart of programming constructs without syntax-bias getting in the way. To elaborate slightly, you can break up programming styles into 3 types: imperative (e.g. C), object oriented (e.g. Smalltalk, Java), and functional (Lisp). With Lua, you can do all three pretty well. Particularly with functional programming, traditionally Lisp or Scheme is used but students get hung up on the parenthesis. And though you have to roll your own object system in Lua, it turns out by doing so, you usually get a very good understanding of what object oriented programming really is. So I would dispute your claim that beginners won’t be helped by starting with Lua when moving on to something else. In fact, I think they may get a better computer science/programming foundation starting with Lua than most other languages. (I started with C++ and my brain was poisoned for years. It took Perl to wake me up to how bad C++ can be (yes, Perl of all languages calling out C++ as bad).) At worst, a person starting with Lua learns nothing useful when moving on, but I claim those people would probably learn nothing starting from any other language too and moving on.

[import]uid: 7563 topic_id: 15765 reply_id: 65202[/import]

I don’t dispute that if you’re completely new to programming, Lua is easy to learn. I learned to program using ZX Spectrum BASIC which was, at first glance, very similar to Lua.

However, a lot of people will come to Lua with some knowledge of another language - PHP, Javascript or Actionscript (Corona makes a big deal, after all, about attracting AS3 coders)- and they will be used to ECMAScript. Furthermore, I don’t think Javascript is any harder to learn than Lua and it would prepare the learner for moving onto other languages.

As I said, it’s not a big deal. It does feel like going back in time somewhat but worth it for the power of the Corona API.

I was just curious to know why the developers of Corona had chosen Lua. What criteria did their choice of scripting language have to fulfil? Just wondering, that’s all! [import]uid: 95579 topic_id: 15765 reply_id: 65211[/import]

Hey Kevin,
Did you program with the Timex ones or the original Sinclar ZX Spectrum? I thought that the ZX were only sold in the European and related markets.

I cannot forget being so excited by the fact that adding an Interface I could allow for extending the Basic language with my own tokens by create ROM vector tables in the printer buffer those were used by the Interface I as it also provided printing support.

Those were the days… The layout of the screen was *in my opinion* one of the most brilliantly laid out scheme. Where each byte could tell you which row, column and line one is referring to.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 15765 reply_id: 65227[/import]

Hi Jayant,
I live in the UK so it was one of the original Sinclair models - I bought it with my first ever wage packet. I’ve still got a couple of Spectrums in the loft!

The BASIC tutorial manual that came with it was one of the best examples of how to teach a language I’ve ever seen.

Most of my early “serious” programming, however, was using STOS on the Atari ST (also still in my loft!)

Looked at from that point of view, Lua has a certain familiar romance to it…

Kev [import]uid: 95579 topic_id: 15765 reply_id: 65234[/import]

I learned to program by typing in the Star Trek game on a Radio Shack TRS-80 level 2 and by reading the Radio Shack beginner’s programming book with the stick character with a monitor head. It was so clear. My second language was MACRO-10 the Assembler language on Dec-10 main frames… Through out college I measured the time it took to learn a new language is hours or days.

Right until I met ‘C’. The crazy syntax of for loops:

for(i=1;i<10;i++){}

was gibberish. Then add in pointers, strings being an array of characters, 0 indexed, char* string and char *string being the same thing… It was a nightmare. Of course I took one look at LISP and said “Oh hellz no!” with all those parens. It was well over a year before I felt comfortable in C.

Then an interesting phenomena happened. I couldn’t learn new languages easily. If it wasn’t C it wasn’t going to stick. Now I should qualify that and say non-C based languages wouldn’t stick. I’m perfectly happy with PHP, JavaScript, AS2 (haven’t messed with AS3 much) and Java were easy pickups.

So Python, Ruby, Perl all languages I’ve looked at in recent years just don’t don’t register with me (okay, I’m not so bad with Perl… I’ve used it a lot and its not that un-C like)

Then the 2nd interesting phenomena happened. I ran into Lua. I took to it like a fly to honey! Sure there is a lot I still don’t know about it, but I don’t have to think about the syntax for the most part and I can go back to my C based languages with little difficulty, other than Lua making me lazy with parens and semi-colons and I still occasionally will try to use curly braces in Lua.
[import]uid: 19626 topic_id: 15765 reply_id: 65239[/import]