cannot read property split of undefined

i got error cannot read property split of undefined while trying to execute this code:

Code:
var tint=$dataMap.meta.tint; t=tint.split(',').map(Number);

switch(tint) {

case "night": $gameScreen.startTint([-102,-85,0,170], 1); break;

case "morning": $gameScreen.startTint([-34,-17,10,68], 1); break;

case "day": $gameScreen.startTint([0,0,0,0], 1); break;

case "evening": $gameScreen.startTint([17,-34,-68,17], 1); break;

case undefined: break;

default: $gameScreen.startTint([t(0),t(1),t(2),t(3)], 1);

}
Split is a function of strings. You'd have to convert $dataMap's tint to a string before using split on it.

Edit: Didn't realise tint was a string, I'm guessing you added it yourself. Hmm, where is it set?
where did you execute that code?
All "undefined" errors mean that you tried to access something that does not exist.
In this case, it is your titn that does not exist - which is no wonder because the meta command doesn't work that way.

Please give screenshots of where you placed those lines, of the editor window that contains the notebox you want to access and the notetag you want to access.
PLease note that this kind of codee worked before so i gguess is a small mistake. It<s a code i recreating after got data lost problem.
I realize that the code fail when tint was not set.... I need to find a way to check that first then...
Code:
var tint=$dataMap.meta.tint;

switch(tint) {

case "night": $gameScreen.startTint([-102,-85,0,170], 1); break;

case "morning": $gameScreen.startTint([-34,-17,10,68], 1); break;

case "day": $gameScreen.startTint([0,0,0,0], 1); break;

case "evening": $gameScreen.startTint([17,-34,-68,17], 1); break;

case undefined: break;

default:

var t=tint.split(',').map(Number);

$gameScreen.startTint([t(0),t(1),t(2),t(3)], 1);

}

This code is better and avoid the error...
Now I just need to post another thread for my other error lol.
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/cannot-read-property-split-of-undefined.74990/