So I did read up a bit on Immediately-Invoked Function Expressions, but I am still not sure I quite comprehend it.
Some plugins seem to put all their code into an IIFE, like this:
others just omit this and put in all their code without an IIFE expression.
Both seems to work most of the time. As far as I have understood it the reson to use IIFE is to hide variables inside its scope and not make them global on accident, is that correct?
Also I seem to have to put some code outside the IIFE, or the game will give me an error, for example if I define a new Scene:
So do I have to declare Scene_Warfare outside the IIFE, or do I just have to change the Syntax if I want to add it inside the IIFE?
Some plugins seem to put all their code into an IIFE, like this:
others just omit this and put in all their code without an IIFE expression.
Both seems to work most of the time. As far as I have understood it the reson to use IIFE is to hide variables inside its scope and not make them global on accident, is that correct?
Also I seem to have to put some code outside the IIFE, or the game will give me an error, for example if I define a new Scene:
works, however
doesn't and just leads to the error "Scene_Warfare is not defined".
So do I have to declare Scene_Warfare outside the IIFE, or do I just have to change the Syntax if I want to add it inside the IIFE?