Safely initialize store data

This commit is contained in:
walterhiggins 2013-01-19 00:44:11 +00:00
parent ae7f7249a0
commit d698d6473b

View file

@ -44,6 +44,10 @@ var arrows = arrows || plugin("arrows",{
*/ */
lightning: function(player){} lightning: function(player){}
},true); },true);
/*
initialize data
*/
arrows.store.players = arrows.store.players || {};
/* /*
private implementation of normal, explosive, teleport, flourish and lightning functions private implementation of normal, explosive, teleport, flourish and lightning functions
@ -79,8 +83,6 @@ ready(function()
called when the player chooses an arrow option from a menu sign called when the player chooses an arrow option from a menu sign
*/ */
var _onMenuChoice = function(event){ var _onMenuChoice = function(event){
if (typeof arrows.store.players == "undefined")
arrows.store.players = {};
arrows.store.players[event.player.name] = event.number; arrows.store.players[event.player.name] = event.number;
}; };
arrows.sign = signs.menu("Arrow", arrows.sign = signs.menu("Arrow",