j-t-d / Roll20DungeonSlayers

Dungeon Slayer scripts for roll20.net api
1 stars 0 forks source link

Make a namespace for our scripts #16

Open Nodlehs opened 11 years ago

Nodlehs commented 11 years ago

We should slap everything under a namespace

var NamespaceName = NamespaceName || {};

Nodlehs commented 11 years ago

From https://app.roll20.net/forum/post/146759/constants-available-to-the-whole-script#post-147508

"I imagine very complex scripts will even take advantage of an "export"/closure-based protection as well, e.g.:"

(function() { //Do stuff in here, only modifying/access konrad if you need to work outside this particular script. })();

j-t-d commented 11 years ago

I've used both methods in the command, encounter, treasure, gm modules. Works well.