Undefined

Status
Not open for further replies.

Mooshry

BTS has consumed my very existence help.
Veteran
Joined
May 30, 2016
Messages
378
Reaction score
145
First Language
English
Primarily Uses
RMMV
Can someone make a plugin where Undefined does something?
Just so Undefined will have a function and i won't get that error anymore.
 

JtheDuelist

Your Friendly Nieghborhood Stygian Zinogre
Veteran
Joined
Dec 9, 2017
Messages
1,180
Reaction score
1,435
First Language
English
Primarily Uses
Other
@Mooshry From the little amount of JS I've learned so far, Undefined is a JS function that is an error handler, so nothing can be done to turn Undefined into a functioning plugin feature.
 

Nolonar

Veteran
Veteran
Joined
Feb 18, 2018
Messages
113
Reaction score
124
First Language
French, German
Primarily Uses
RMMV
Sorry, but that's impossible. If undefined did something or had a function, it would no longer be undefined. So even if you try to overwrite undefined with something, it would still be undefined. Even if it were possible to change undefined, that would be a very, very, very bad idea.

When undefined throws an error, it's because you have a bug. If it stopped throwing errors, you'd still have the bug, but now you don't know where the bug happens.


However, the biggest problem by far is that undefined doesn't always throws errors.
You can for example do:
Code:
if (event) {
    // do something
}
If event is undefined, then the code inside the if branch won't execute. That's because undefined is not truthy (it doesn't evaluate to true).

By adding a function to undefined, it would become an object (one that contains a function) and become truthy. This would break not only a large number of plugins, but might also completely break the RMMV core scripts as well.


TL;DR
Just don't do it.
 
Last edited:

Mooshry

BTS has consumed my very existence help.
Veteran
Joined
May 30, 2016
Messages
378
Reaction score
145
First Language
English
Primarily Uses
RMMV
Oh. I didn't know anything about JS, so i thought undefined was just a thing that was there just chillin', waiting to be a function.

(I can just imagine someone going like: Hey guys! I made undefined a function! And then everyone goes volcanic.)
 

Nolonar

Veteran
Veteran
Joined
Feb 18, 2018
Messages
113
Reaction score
124
First Language
French, German
Primarily Uses
RMMV
(I can just imagine someone going like: Hey guys! I made undefined a function! And then everyone goes volcanic.)
Yes, that is correct.

If you want to know more about how it could break things, I was just editing my previous response when you wrote this post.

The bottom line is: you would indeed break a lot of things by defining undefined or even add a function to it.
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
14,775
Reaction score
8,198
First Language
English
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

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

Latest Threads

Latest Profile Posts

JDgoldvox wrote on Mr. Detective's profile.
hey, could u help me with a problem? basically, How do I delete a character from a map after a cut scene is over? I am really new with RPG maker MV. Please help!
The most rewarding part of making custom body character parts is absolutely not making the masks work. Somebody please put me out of my misery.
Any commercial devs here ever mess with Gamejolt? Been contemplating making my games available there but don't know if it's worth the effort or not.
Social distancing taught me of how much of not a loner I am. Dammit, I miss seeing my friends...
Happy 4th of July all. Anybody have plans? Mine here is staying home away from the virus. Still a nice 3 day weekend.

Forum statistics

Threads
99,263
Messages
963,617
Members
130,856
Latest member
superfluffy
Top