Undefined

Status
Not open for further replies.

Mooshry

BTS has consumed my very existence help.
Veteran
Joined
May 30, 2016
Messages
395
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,185
Reaction score
1,440
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
163
Reaction score
243
First Language
French, German
Primarily Uses
RMMZ
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
395
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
163
Reaction score
243
First Language
French, German
Primarily Uses
RMMZ
(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
15,354
Reaction score
8,533
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 Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,570
Latest member
fgfhdfg
Top