mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-21 10:49:50 -04:00
Variables and lists (#187)
* Import lists and variables from SB2 * Switch to Variable and List objects * Add Clone.lookupOrCreateVariable, Clone.getVariable, Clone.setVariable * Add (get, set, change) variable blocks. * Copy variables and lists on clone instantiation * Move variable options closer to blocks * Add list primitives * Move variable and lists storage to `Target` instead of `Clone` * Move _computeIndex to a Cast function * Rename `getList` -> `getListAsString` * Renames renames * Remove extra check in Cast.isNaN
This commit is contained in:
parent
a687184c3c
commit
a118d50056
8 changed files with 302 additions and 3 deletions
src/engine
18
src/engine/variable.js
Normal file
18
src/engine/variable.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* @fileoverview
|
||||
* Object representing a Scratch variable.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {!string} name Name of the variable.
|
||||
* @param {(string|Number)} value Value of the variable.
|
||||
* @param {boolean} isCloud Whether the variable is stored in the cloud.
|
||||
* @constructor
|
||||
*/
|
||||
function Variable (name, value, isCloud) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.isCloud = isCloud;
|
||||
}
|
||||
|
||||
module.exports = Variable;
|
Loading…
Add table
Add a link
Reference in a new issue