This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
jasper2428's profile picture

Why Lua for CC?

Started by jasper2428, 10 April 2013 - 10:56 PM
jasper2428 #1
Posted 11 April 2013 - 12:56 AM
-
Edited on 28 January 2016 - 04:10 PM
Shnupbups #2
Posted 11 April 2013 - 01:01 AM
Most likely because it's a fairly simple language to learn, easily expandable, and LuaJ already existed. Even though Java would have been more simple for dan to implement, I think he went with Lua for simplicity's sake.
Kingdaro #3
Posted 11 April 2013 - 01:08 AM
Not only is Java incredibly overly complicated, it's also incredibly unsafe, along with most (if not all) the languages OP listed. Most well known scripting and programming languages have a million and a half different APIs that would make them hard to sandbox.

Securiy aside, Lua is fast, lightweight, and flexible. Other languages are just bloated with a bunch of unnecessary syntaxes and APIs.
Mikeemoo #4
Posted 11 April 2013 - 01:13 AM
As has been said, Lua is very simple for new programmers to learn - and the majority of minecraft players aren't programmers.

That said, if dan or Cloudy could ever give add javascript support, I'd love them forever. As far as I know it's certainly possible, however, I'm sure it'd be a huge amount of work and when you consider that most of the minecraft player base don't know the difference between lua and javascript, probably not worth the effort.
jasper2428 #5
Posted 11 April 2013 - 01:23 AM
-
Edited on 28 January 2016 - 04:10 PM
Kingdaro #6
Posted 11 April 2013 - 02:06 AM
Oh well! Why don't we just add en.wikipedia.org/wiki/Brainfuck as one of the programming languages because its super simple and is basically the fastest to learn! It's also basically a Turing Machine! *sarcasm*
May as well add My God It's Full of Stars too!

As has been said, Lua is very simple for new programmers to learn - and the majority of minecraft players aren't programmers.

That said, if dan or Cloudy could ever give add javascript support, I'd love them forever. As far as I know it's certainly possible, however, I'm sure it'd be a huge amount of work and when you consider that most of the minecraft player base don't know the difference between lua and javascript, probably not worth the effort.
I want to say that I dislike JavaScript but I've been working with it so much recently that it's starting to grow on me. I just don't like languages that use more symbols over words in general, because sh** like this pisses me off:


$(document).ready(function() {
  $('something').click(function() {
    alert($('something').val());
  });
});

Sure it's easy to write but half the time I look back at it and I'm like "wtf jquery?" At that point I may as well just code in Japanese.
jasper2428 #7
Posted 11 April 2013 - 02:16 AM
-
Edited on 28 January 2016 - 04:11 PM
Mikeemoo #8
Posted 11 April 2013 - 02:20 AM
Sure it's easy to write but half the time I look back at it and I'm like "wtf jquery?" At that point I may as well just code in Japanese.


Sure, but you're showing jQuery as an example, which is a javascript library that has a quite different/distinctive design pattern to how you'd code raw javascript.

Javascript itself isn't hugely different from any other C-based language - PHP/C#/C/Java/whatever.
SadKingBilly #9
Posted 11 April 2013 - 02:51 AM
I'm really happy dan chose Lua, because the more time I spend with it, the more I like it. And if it weren't for ComputerCraft, I might have gone the rest of my life without ever learning it.

But as for the reason dan chose it? I would assume because it is one of the easiest languages to just pick up, and dan knew that a lot of MineCraft players are young and unfamiliar with programming. And could you imagine having to deal with Python's reliance on whitespace from within a ComputerCraft computer?
Kingdaro #10
Posted 11 April 2013 - 03:43 AM
Sure it's easy to write but half the time I look back at it and I'm like "wtf jquery?" At that point I may as well just code in Japanese.


Sure, but you're showing jQuery as an example, which is a javascript library that has a quite different/distinctive design pattern to how you'd code raw javascript.

Javascript itself isn't hugely different from any other C-based language - PHP/C#/C/Java/whatever.
Fair enough, but my preference of words over symbols still stands. Especially with PHP's goddamn dollar signs.

PHP is stupid in general though. JavaScript is at least bearable and waaay less demanding of a constant lookup to the wiki to see "if there's a function for this."
Mikeemoo #11
Posted 11 April 2013 - 04:11 AM
I don't want to go into a big discussion about this, but I just want to say one thing..

I've been a programmer for 17-ish years now, working as a professional programmer for 12 years, over a wide variety of languages and platforms. I don't really consider any language to be stupid.

PHP may seem stupid to some, but to others it clearly makes a lot of sense, which is why it's a very widely used language. All popular languages have their uses, else they wouldn't be used.

Try not to consider any language as stupid or not as good as another. Use the best language for the job you're looking to do. When you start writing proper namespaced PHP 5.3, it's almost identical to java except that java is a strictly typed language, which is just the same as C#, and they're both similar to actionscript, which isn't a million miles away from javascript..etc..
Sammich Lord #12
Posted 11 April 2013 - 04:44 AM
I don't want to go into a big discussion about this, but I just want to say one thing..

I've been a programmer for 17-ish years now, working as a professional programmer for 12 years, over a wide variety of languages and platforms. I don't really consider any language to be stupid.

PHP may seem stupid to some, but to others it clearly makes a lot of sense, which is why it's a very widely used language. All popular languages have their uses, else they wouldn't be used.

Try not to consider any language as stupid or not as good as another. Use the best language for the job you're looking to do. When you start writing proper namespaced PHP 5.3, it's almost identical to java except that java is a strictly typed language, which is just the same as C#, and they're both similar to actionscript, which isn't a million miles away from javascript..etc..
+1
Perfectly said man.
dan200 #13
Posted 11 April 2013 - 05:13 AM
probably JavaScript would of been as equally good choice as Lua (although, does it have anything like coroutines?). I chose Lua due to my familiarity with it, and it's extremely widespread use in the games industry.
Dlcruz129 #14
Posted 11 April 2013 - 05:17 AM
I think Lua was a great choice. It's simple, easy to learn, and LuaJ already existed which made it easier on dan.
ds84182 #15
Posted 11 April 2013 - 11:31 AM
I'm going to contribute.
Lua isn't the simplest programming language, but it is the simplest available.
If have ever used GlovePIE (Programmable Input Emulator) it has it's own custom scripting language. The language supports different ways to loops. You can do the standard while true do like this:
while (true)
{
print("Hello, World!");
}
or
while true do
print("Hello, World!")
end
Though the language source code is Not Available, it is simpler than Lua, especially if you are coming from something like JS.
Kingdaro #16
Posted 11 April 2013 - 11:35 AM
That's not simple. Simple is:

while true
    print 'Hello World!'
And that's moonscript. The language you mention is only flexible and has different syntactical options, which pushes it further away from the line of simplicity. Simple (in my dictionary, anyway) usually means thinking less, typing less, and reading less.
NotAmaster #17
Posted 11 April 2013 - 12:13 PM
When I was trying to learn java in a book, I read that at first people wanted to just do

print "Hello World!" nonstop for every 10 seconds.
and it would be that same as (in Lua)

while true do
  print("Hello World!")
  sleep(10)
end
And now it makes me think, how much easier programming would be at that point, it would also force people to use correct grammar, so that can't just be lazy.
EDIT: My 5th post :o/>
Kingdaro #18
Posted 11 April 2013 - 04:35 PM
Except, by default, Lua has no sleep function.
SuicidalSTDz #19
Posted 11 April 2013 - 04:48 PM
Except, by default, Lua has no sleep function.
However, it is so flexible that one can be made :P/> (obviously) I think Lua was the best choice for ComputerCraft. Not saying that JavaCraft isn't cool. But, meh.
Azhf #20
Posted 11 April 2013 - 04:53 PM
First of all, (offtopic) Suicidal! What happened to "The enderman reject your existence for the greater good"? I loved that :P/> Also, lol, Permulator of Strings.


When I was trying to learn java in a book, I read that at first people wanted to just do

print "Hello World!" nonstop for every 10 seconds.
and it would be that same as (in Lua)

while true do
  print("Hello World!")
  sleep(10)
end
And now it makes me think, how much easier programming would be at that point, it would also force people to use correct grammar, so that can't just be lazy.
EDIT: My 5th post :o/>
You get alot of them fast.


Anyways, I've seen some sort of variation of Murrika alot lately :P/>

EDIT: Permutator*
Engineer #21
Posted 12 April 2013 - 12:33 PM
I think CCLua is a great way to get into programming. It was my first programming language, and to this day I program as a hobby. I love it!

To get to the point, Lua have stimulated me to get into programming. I mean, a programming language is a language that has a specific syntax for what similair programming languages has.
Of course, the programming language is intended for a purpose.

For example, a for loop in 3 different languages;

for i = 1, 7 do
   --shizzle
end

for(int i = 0; i < 7; i++){
   // stuff
}

for($i = 0; $i < 7; $i++){
  // stuff
}
for those who dont know: Lua, Java and php.

This is what have driven me to program, and I want to thank dan200 and cloudy for that. You guys rock, also the great community here cant be forgotten :)/>

And Im not saying Im a professional in those programming languages, its a hobby, remember?:P/>

To be back on topic:
Lua was to me easy to learn, and if it was more advanced (referring to syntax) I personally think this wasnt a great mod for minecraft as it is now
Mailmanq! #22
Posted 13 April 2013 - 11:39 AM
Lua also has amazing documentation. It is simple for people new to programming and not too crazy for people who have used other languages to get. It combines the best of all the languages. It is just Lua and awesome like that. Javascript would be a good option too as stated above, but Lua has just been used for many things embedded into other things n' stuff. I don't know what I am talking about anymore.

Edit: The ~= still just seems like they were trying to be different.