Lamda not allowed in RM?

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
424
Reaction score
171
First Language
Dutch
Primarily Uses
RMMV
var test = [2, 5, 8, 1, 4].some(f => f === 11); // error, unexpected token =>Has it to do with the JavaScript version being used in RM or something or why can't we used lambda's? They shorten code so nicely.

Other options are (but are longer):

var test = [2, 5, 8, 1, 4, 11].some(function (effect) { return effect == 11; } )And lastly you can obviously loop through it with a for-loop, being the most ugly solution.
 
Last edited by a moderator:

Dr.Yami

。◕‿◕。
Developer
Joined
Mar 5, 2012
Messages
1,003
Reaction score
757
First Language
Vietnamese
Primarily Uses
Other
Arrow functions are new feature in ES6, while RMMV is using ES5 standard :)
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
Use anonymous functions:

Code:
var test = [2, 5, 8, 1, 4].some(function(e) { return e > 10; });
 

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
424
Reaction score
171
First Language
Dutch
Primarily Uses
RMMV
<sorry double post>
 
Last edited by a moderator:

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
424
Reaction score
171
First Language
Dutch
Primarily Uses
RMMV
Arrow functions are new feature in ES6, while RMMV is using ES5 standard :)
;_;

Use anonymous functions:

var test = [2, 5, 8, 1, 4].some(function(e) { return e > 10; });
Yeah you ninja-ed my edit :p . Yeah that's what I do now. Would prefer lambda though like in C#. I love lambda. But this is acceptable.
 
Last edited by a moderator:

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
MV uses Chrome 42, as that's what was available from NWJS at the time MV was in development (and, at the time of writing this, the version shipping with MV is still the latest stable release available, but a new one is in the works with a newer version of Chrome). You'll have to wait for an updated version of Chrome to be released with NWJS that supports ore ES6 features.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Are we allowed to post about non-RPG Maker games?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:

Forum statistics

Threads
105,883
Messages
1,017,236
Members
137,608
Latest member
Arm9
Top