Page 1 of 1

JavaScript for moddding

PostPosted: Tue Apr 29, 2014 13:20
by drkwv
Is there any chance of adding JavaScript as a language used for modding? Programming with Lua is pain. It even doesn't recognize != operator. It blows my mind. I hate Lua. Lua is a bullet that missed it's aim. They wanted simple pretty language but created a freaking brain-eating monster instead.

Re: JavaScript for moddding

PostPosted: Tue Apr 29, 2014 13:27
by kaeza
This has already been discussed here.

Re: JavaScript for moddding

PostPosted: Tue Apr 29, 2014 14:34
by sfan5

Re: JavaScript for moddding

PostPosted: Tue Apr 29, 2014 15:08
by BrandonReese
Use ~= instead of !=

Problem solved

Re: JavaScript for moddding

PostPosted: Tue Apr 29, 2014 15:37
by Evergreen
No. Just no.

Re: JavaScript for moddding

PostPosted: Tue Apr 29, 2014 16:16
by PilzAdam
Yea sure, we start recoding thousands of lines of the engine and break every single mod because you want to use != instead of ~=.

Re: JavaScript for moddding

PostPosted: Tue Apr 29, 2014 18:54
by OmniStudent
drkwv wrote:Is there any chance of adding JavaScript as a language used for modding? Programming with Lua is pain. It even doesn't recognize != operator. It blows my mind. I hate Lua. Lua is a bullet that missed it's aim. They wanted simple pretty language but created a freaking brain-eating monster instead.


I like your passion :-)

Re: JavaScript for moddding

PostPosted: Tue Apr 29, 2014 20:21
by drkwv
PilzAdam wrote:Yea sure, we start recoding thousands of lines of the engine and break every single mod because you want to use != instead of ~=.

sfan5 wrote:Please compare Why JavaScript sucks and Why Lua sucks

Well, I see the point. But, just to satisfy my curiosity, why not Python then? Does the Python has ever been considered before you decided to choose Lua?
BrandonReese wrote:Use ~= instead of !=
Problem solved

No. Just no.

Re: JavaScript for moddding

PostPosted: Tue Apr 29, 2014 20:36
by sfan5
drkwv wrote:
PilzAdam wrote:Yea sure, we start recoding thousands of lines of the engine and break every single mod because you want to use != instead of ~=.

sfan5 wrote:Please compare Why JavaScript sucks and Why Lua sucks

Well, I see the point. But, just to satisfy my curiosity, why not Python then? Does the Python has ever been considered before you decided to choose Lua?

Lua was chosen because it is more lightweight than Python.

Re: JavaScript for moddding

PostPosted: Tue Apr 29, 2014 20:38
by spillz
I don't think it would be terribly hard to write bindings for python using the Lua api as a starting point. But not clear enough people would use it to make it worthwhile (you and maybe me). And it would fragment development. And as far as i can tell, most devs are happy enough with lua and the ones who aren't probably want c++ mods.

So unless you are interested in maintaining a Javascript or python or whatever port just stick with lua. Code in it for a week and you will adapt well enough.

Re: JavaScript for moddding

PostPosted: Tue Apr 29, 2014 22:36
by philipbenr
spillz wrote:Code in it for a week and you will adapt well enough.


I think that Lua is fine for Minetest, and it is very easy to learn. I did it in one day. (Not very extensively, but hey)...

Re: JavaScript for moddding

PostPosted: Wed Apr 30, 2014 11:44
by Krock
philipbenr wrote:
spillz wrote:Code in it for a week and you will adapt well enough.


I think that Lua is fine for Minetest, and it is very easy to learn. I did it in one day. (Not very extensively, but hey)...

Lua is confusing for programmers:
~= instead of !=
no var++ method
indexing starts at 1 instead of 0
everything is just one type of variable. my first try to define a string
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
string test = "Hello world";

Re: JavaScript for moddding

PostPosted: Wed Apr 30, 2014 12:14
by Kilarin
Krock wrote:Lua is confusing for programmers

Every programming language is a little different. I've worked in Java, C, PRPC, COBOL, VB, Assembler, Pascal, Javascript, Notetab Clips, Jython, and probably at least 8 different forms of Basic. If Lua began it's indexing at 0 instead of 1 it would be confusing to programmers from a different background.

What's tripping me up the most is Lua's requirement for a "then" on an if. But when I first switched from primarily programming in Pascal to primarily programming in Java, it was the LACK of a "then" that confused me. Every programming language has it's individual quirks.

As for everything being one type of variable, yeah, it is still taking me a while to get used to that, but that is one of Lua's strengths. It is designed to be a scripting language that works easily when interacting with just about any other parent language. Because Lua's variables are not strongly typed, they are VERY flexible.

Lua is simple and obvious enough that even non-programmers can work in it pretty quickly with just a few examples.

Re: JavaScript for moddding

PostPosted: Wed Apr 30, 2014 14:00
by rubenwardy
I wouldn't like vanilla Javascript to be used for modding. However, Google makes a version which has classes, and it is open source.

It is best to keep with Lua, though.

Re: JavaScript for moddding

PostPosted: Wed Apr 30, 2014 14:15
by philipbenr
rubenwardy wrote:It is best to keep with Lua, though.


I second that.

Re: JavaScript for moddding

PostPosted: Wed Apr 30, 2014 14:17
by rubenwardy
philipbenr wrote:
rubenwardy wrote:It is best to keep with Lua, though.


I second that.


The reason I say that is not because it is any better (I don't really have an opinion on that), but because it would be a PITA to modify the engine to either:

  • Add multiple languages
  • Switch to JavaScript.

Re: JavaScript for moddding

PostPosted: Wed Apr 30, 2014 14:21
by philipbenr
Plus, adding more languages would make things more complex, make the engine heavier, and take up much more space.

Re: JavaScript for moddding

PostPosted: Wed Apr 30, 2014 15:04
by JPRuehmann
Hi
<sarcasm>Java script is a pain in th as to! let us use bash.</sarcasm>
have Fun,
JPR

Re: JavaScript for moddding

PostPosted: Wed Apr 30, 2014 15:39
by sfan5
Krock wrote:
philipbenr wrote:
spillz wrote:Code in it for a week and you will adapt well enough.


I think that Lua is fine for Minetest, and it is very easy to learn. I did it in one day. (Not very extensively, but hey)...

Lua is confusing for programmers:
~= instead of !=
no var++ method
indexing starts at 1 instead of 0
everything is just one type of variable. my first try to define a string
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
string test = "Hello world";

C++ is confusing for programmers:
!= instead of ~=
WTF does var++ do?
indexing starts at 0 instead of 1
every variable needs to have types. my first try to define a string
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
test = "Hello world"

Do you notice something?

Re: JavaScript for moddding

PostPosted: Wed Apr 30, 2014 19:10
by HeroOfTheWinds
The back-and-forth in this thread is making me split my sides in laughter. But seriously.

It's true: every language has its quirks. I started in Python, but then moved to Visual Basic, and couldn't wrap my head around the reason they make you say "dim" before declaring variables. Every language is going to have something that someone doesn't like, and that's not restricted to programming languages either. It just has to be dealt with and move on. I didn't like lua at first either, but I got used to it, and now I'm attempting to code things that I consider pretty neat. I wouldn't go using Lua to program the next Legend of Zelda, but it certainly gets the job done for a lightweight language to code mods for Minetest.

If you really despise Lua that much, do this, which I'm sure you'll find even less agreeable: Code a program that lets you write a mod in JavaScript, and then have that program convert your JS code to Lua automatically. Problem solved, everybody happy. (If you're an optimist.)

Re: JavaScript for moddding

PostPosted: Wed Apr 30, 2014 19:26
by kaeza
Krock wrote:everything is just one type of variable

Lua Manual wrote:Lua is a dynamically typed language. This means that variables do not have types; only values do. There are no type definitions in the language. All values carry their own type.

Re: JavaScript for moddding

PostPosted: Fri May 09, 2014 15:42
by aldobr
I write my own programming languages for breakfest.

Lua is ok.

Real programmers (TM) can use any turing complete language, period.

Re: JavaScript for moddding

PostPosted: Sat May 17, 2014 13:10
by D0431791
+1. I think somebody will branch Minetest and implement a javascript Modding System.

Re: JavaScript for moddding

PostPosted: Sat May 17, 2014 13:22
by rubenwardy
D0431791 wrote:+1. Somebody will branch Minetest and implement a javascript Modding System.


Why the guarantee?