Somehow eval() doesn't want to evaluate my string

so I have a code which looks like this


if (item.meta.max) {
return eval(item.meta.max);
};


With item.meta.max being "$gameVariables(1)"


but when the code is called, it returns an error that says object is not a function. the nodekit console points to item.meta.max line during this error


I already made sure that item.meta.max returns "$gameVariables(1)" via a show text event so somehow eval doesn't seem to want to evaluate it.. 


Anyone has an idea of the problem here?
You use the function $gameVariables.value(variableId) to get the value of a variable.


The actual array of game variables is stored in $gameVariables._data. You'd access a particular variable directly via $gameVariables._data[varaibleId].


The _data array is a property of the $gameVariables object. That's why you get that error.


The object structures can be viewed via the console. Press F8, type console.log(window) and search for whatever you want to modify.


To see the list of natively available functions I recommend grabbing zalerinian's split files.
Oh I see, thanks a lot! I always forget that most of the things directly accessible back on RGSSx have getter and setter functions on MV  🙂


PS: how do I select the post that gets marked as the answer?
it doesn't look like the script forums have that feature enabled - if it did, you wouldn't miss it.

Original thread: https://forums.rpgmakerweb.com/threads/somehow-eval-doesnt-want-to-evaluate-my-string.72802/