It looks like you're new here. If you want to get involved, click one of these buttons!
:: Db [script] window.ns = {};//namespace window.ns.Db = class NpcDb { constructor() { this.value = 100; } giveValue() { return this.value; } }
:: StoryInit <<set $db to new ns.Db()>>
:: Sample [nobr] Test. <<print $db.giveValue()>>
Test. 100Via Chrome Developper Console
Object.getOwnPropertyNames(SugarCube.State.active.variables.db.__proto__); ["constructor", "giveValue"]
Test. Error: <<print>>: bad evaluation: State.variables.db.giveValue is not a function
Object.getOwnPropertyNames(SugarCube.State.active.variables.db.__proto__); ["hasOwnProperty", "constructor", "toString", "toLocaleString", "valueOf", "isPrototypeOf", "propertyIsEnumerable", "__defineGetter__", "__lookupGetter__", "__defineSetter__", "__lookupSetter__", "__proto__"]
Comments