RangeError Maximum call stack size exceededの回避
Posted: 2017年9月13日(水) 18:57
以下のプラグインコマンドで、firebase_initを呼び出すと
RangeError Maximum call stack size exceeded
と表示されます。
ID_INITは、以前は別のプラグインに入れてましたが、現在はまとめています。
それで原因は何かなと思い、ID_INITの部分をまるまる削除して実行すると
エラーが発生しなくなりました。
ID_INITは別のプラグインで問題なく動いており単純にgetTimeでID作って
変数に入れ、プラグインで保存しているだけですので、単純に関数呼び出しの
スタックオーバーフローなのかなと思います。
他の言語では故意にオーバフローするような記述をしない限り見たことないのですが
回避方法はあるのでしょうか?
//プラグインコマンド
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.apply(this, arguments);
if(command === 'ID_INIT'){
setTimeOut(id_init,0);
//セーブデータがあるなら
if(DataManager.isAnySavefileExists()){
//共有セーブデータからロード
utakata.CommonSaveManager.load();
}else{
var tmtmp = new Date();
tmtmp=tmtmp.getTime();
$gameVariables.setValue(userIdVariableNo,tmtmp);
utakata.CommonSaveManager.save();
}
}
if (command == 'firebase_init') {
//firebase初期化
TOMO_FireBase_init();
}
if (command == 'make_lobby') {
//firebase初期化
//lobby_View(args[0]);
//make_lobby(args[0],args[1],args[2],args[3],args[4]);
}
if (command == 'test1') {
//firebase初期化
//console.log($gameActors.actor(0).level);
}
if (command == 'lobby_View') {
//firebase初期化
//lobby_View(args[0]);
}
}
RangeError Maximum call stack size exceeded
と表示されます。
ID_INITは、以前は別のプラグインに入れてましたが、現在はまとめています。
それで原因は何かなと思い、ID_INITの部分をまるまる削除して実行すると
エラーが発生しなくなりました。
ID_INITは別のプラグインで問題なく動いており単純にgetTimeでID作って
変数に入れ、プラグインで保存しているだけですので、単純に関数呼び出しの
スタックオーバーフローなのかなと思います。
他の言語では故意にオーバフローするような記述をしない限り見たことないのですが
回避方法はあるのでしょうか?
//プラグインコマンド
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.apply(this, arguments);
if(command === 'ID_INIT'){
setTimeOut(id_init,0);
//セーブデータがあるなら
if(DataManager.isAnySavefileExists()){
//共有セーブデータからロード
utakata.CommonSaveManager.load();
}else{
var tmtmp = new Date();
tmtmp=tmtmp.getTime();
$gameVariables.setValue(userIdVariableNo,tmtmp);
utakata.CommonSaveManager.save();
}
}
if (command == 'firebase_init') {
//firebase初期化
TOMO_FireBase_init();
}
if (command == 'make_lobby') {
//firebase初期化
//lobby_View(args[0]);
//make_lobby(args[0],args[1],args[2],args[3],args[4]);
}
if (command == 'test1') {
//firebase初期化
//console.log($gameActors.actor(0).level);
}
if (command == 'lobby_View') {
//firebase初期化
//lobby_View(args[0]);
}
}