JavaScript for moddding

drkwv
Member
 
Posts: 67
Joined: Thu Jun 28, 2012 13:48

JavaScript for moddding

by drkwv » Tue Apr 29, 2014 13:20

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.
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: JavaScript for moddding

by kaeza » Tue Apr 29, 2014 13:27

This has already been discussed here.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

Re: JavaScript for moddding

by sfan5 » Tue Apr 29, 2014 14:34

Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
BrandonReese
Member
 
Posts: 836
Joined: Wed Sep 12, 2012 00:44
GitHub: bremaweb
IRC: BrandonReese
In-game: BrandonReese

Re: JavaScript for moddding

by BrandonReese » Tue Apr 29, 2014 15:08

Use ~= instead of !=

Problem solved
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Re: JavaScript for moddding

by Evergreen » Tue Apr 29, 2014 15:37

No. Just no.
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

Re: JavaScript for moddding

by PilzAdam » Tue Apr 29, 2014 16:16

Yea sure, we start recoding thousands of lines of the engine and break every single mod because you want to use != instead of ~=.
 

OmniStudent
Member
 
Posts: 261
Joined: Sat Nov 03, 2012 06:40

Re: JavaScript for moddding

by OmniStudent » Tue Apr 29, 2014 18:54

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 :-)
 

drkwv
Member
 
Posts: 67
Joined: Thu Jun 28, 2012 13:48

Re: JavaScript for moddding

by drkwv » Tue Apr 29, 2014 20:21

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.
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

Re: JavaScript for moddding

by sfan5 » Tue Apr 29, 2014 20:36

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.
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

spillz
Member
 
Posts: 138
Joined: Thu Feb 13, 2014 05:11

Re: JavaScript for moddding

by spillz » Tue Apr 29, 2014 20:38

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.
 

User avatar
philipbenr
Member
 
Posts: 1665
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: WisdomFire or philipbenr

Re: JavaScript for moddding

by philipbenr » Tue Apr 29, 2014 22:36

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)...
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: JavaScript for moddding

by Krock » Wed Apr 30, 2014 11:44

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";
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: JavaScript for moddding

by Kilarin » Wed Apr 30, 2014 12:14

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.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: JavaScript for moddding

by rubenwardy » Wed Apr 30, 2014 14:00

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.
 

User avatar
philipbenr
Member
 
Posts: 1665
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: WisdomFire or philipbenr

Re: JavaScript for moddding

by philipbenr » Wed Apr 30, 2014 14:15

rubenwardy wrote:It is best to keep with Lua, though.


I second that.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: JavaScript for moddding

by rubenwardy » Wed Apr 30, 2014 14:17

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.
 

User avatar
philipbenr
Member
 
Posts: 1665
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: WisdomFire or philipbenr

Re: JavaScript for moddding

by philipbenr » Wed Apr 30, 2014 14:21

Plus, adding more languages would make things more complex, make the engine heavier, and take up much more space.
 

User avatar
JPRuehmann
Member
 
Posts: 334
Joined: Fri Mar 21, 2014 21:40

Re: JavaScript for moddding

by JPRuehmann » Wed Apr 30, 2014 15:04

Hi
<sarcasm>Java script is a pain in th as to! let us use bash.</sarcasm>
have Fun,
JPR
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

Re: JavaScript for moddding

by sfan5 » Wed Apr 30, 2014 15:39

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?
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
HeroOfTheWinds
Member
 
Posts: 470
Joined: Wed Apr 23, 2014 23:16
GitHub: HeroOfTheWinds
IRC: WindHero

Re: JavaScript for moddding

by HeroOfTheWinds » Wed Apr 30, 2014 19:10

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.)
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: JavaScript for moddding

by kaeza » Wed Apr 30, 2014 19:26

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.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

User avatar
aldobr
Member
 
Posts: 316
Joined: Sun Nov 25, 2012 05:46

Re: JavaScript for moddding

by aldobr » Fri May 09, 2014 15:42

I write my own programming languages for breakfest.

Lua is ok.

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

D0431791
Member
 
Posts: 19
Joined: Wed Nov 06, 2013 11:43

Re: JavaScript for moddding

by D0431791 » Sat May 17, 2014 13:10

+1. I think somebody will branch Minetest and implement a javascript Modding System.
Last edited by D0431791 on Mon May 19, 2014 07:20, edited 1 time in total.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: JavaScript for moddding

by rubenwardy » Sat May 17, 2014 13:22

D0431791 wrote:+1. Somebody will branch Minetest and implement a javascript Modding System.


Why the guarantee?
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 5 guests

cron