Lists Blocks

Object Operators

{"func":"valueObjKeys"}

Keys Of

"Keys Of" gets the keys in the specified object as a list.

Parameters:

Object: This is the object to get the keys of. (Drag a variable/list block into this space.)

Related Blocks:
{"func":"blockObjSet"} ,     {"func":"valueObjGet"} ,     {"func":"blockObjDel"} ,     {"func":"valueObjLength"} ,     {"func":"valueObjValues"}

Sample Code:
{"func":"blockControlForEach","values":[{"type":"wrapper","func":"valueObjKeys","values":[{"type":"wrapper","func":"valueVar","name":"fnames"}]},{"type":"string","value":"i"}],"containers":[{"func":"blockLooksSayFor","values":[{"type":"wrapper","func":"valueObjGet","values":[{"type":"wrapper","func":"valueVar","name":"fnames"},{"type":"wrapper","func":"valueScriptVar","name":"i"}]},{"type":"number","value":"2"}]}]} Add to my Backpack


{"func":"valueObjValues"}

Values Of

"Values Of" gets the values in the specified object as a list.

Parameters:

Object: This is the object to get the values of. (Drag a variable/list block into this space.)

Related Blocks:
{"func":"blockObjSet"} ,     {"func":"valueObjGet"} ,     {"func":"valueObjLength"} ,     {"func":"valueObjKeys"}

Sample Code:
{"func":"blockControlForEach","values":[{"type":"wrapper","func":"valueObjValues","values":[{"type":"wrapper","func":"valueList","name":"directory"}]},{"type":"string","value":"name"}],"containers":[{"func":"blockLooksSayFor","values":[{"type":"wrapper","func":"valueObjGet","values":[{"type":"wrapper","func":"valueVar","name":"name"},{"type":"string","value":"0"}]},{"type":"number","value":"2"}]}]} Add to my Backpack


{"func":"valueListNew"}

New List

"New List" returns a new empty list.

Parameters:

None.

Related Blocks:
{"func":"blockObjSet"} ,     {"func":"valueObjGet"} ,     {"func":"blockObjDel"} ,     {"func":"valueObjLength"} ,     {"func":"valueObjNew"}

Sample Code:
{"func":"blockObjSet","values":[{"type":"wrapper","func":"valueList","name":"directory"},{"type":"wrapper","func":"valueScriptVar","name":"i"},{"type":"wrapper","func":"valueListNew"}]} Add to my Backpack


{"func":"valueObjectNew"}

New Object

"New Object" returns a new empty object.

Parameters:

None.

Related Blocks:
{"func":"blockObjSet"} ,     {"func":"valueObjGet"} ,     {"func":"blockObjDel"} ,     {"func":"valueObjLength"} ,     {"func":"valueListNew"}

Sample Code:
{"func":"blockObjSet","values":[{"type":"wrapper","func":"valueList","name":"directory"},{"type":"wrapper","func":"valueScriptVar","name":"i"},{"type":"wrapper","func":"valueObjNew"}]} Add to my Backpack


{"func":"blockObjSet"}

Set Value Of

"Set Value Of" sets the value of the specified object to the specified value.

Parameters:

Object: This is the object to set the value of. (Drag a variable/list block into this space.)

Key: This is the key/index of the variable. (Use 0-indexing.)

Value: This is the value to set to.

Related Blocks:
{"func":"valueObjGet"} ,     {"func":"blockObjDel"} ,     {"func":"valueObjLength"} ,     {"func":"valueObjKeys"} ,     {"func":"valueObjValues"}

Sample Code:
{"func":"blockControlFor","values":[{"type":"string","value":"i"},{"type":"number","value":"0"},{"type":"number","value":3},{"type":"number","value":"1"}],"containers":[{"func":"blockObjSet","values":[{"type":"wrapper","func":"valueList","name":"directory"},{"type":"wrapper","func":"valueScriptVar","name":"i"},{"type":"wrapper","func":"valueListNew"}],"next":{"func":"blockObjSet","values":[{"type":"wrapper","func":"valueObjGet","values":[{"type":"wrapper","func":"valueList","name":"directory"},{"type":"wrapper","func":"valueScriptVar","name":"i"}]},{"type":"string","value":"0"},{"type":"wrapper","func":"valueObjGet","values":[{"type":"wrapper","func":"valueVar","name":"fnames"},{"type":"wrapper","func":"valueScriptVar","name":"i"}]}]}}]} Add to my Backpack


{"func":"blockObjDel"}

Delete Value Of

"Delete Value Of" deletes the value of the specified object.

Parameters:

Object: This is the object to delete the value of. (Drag a variable/list block into this space.)

Key: This is the key/index of the variable. (Use 0-indexing.)

Related Blocks:
{"func":"valueObjSet"} ,     {"func":"valueObjGet"} ,     {"func":"valueObjLength"} ,     {"func":"valueObjKeys"} ,     {"func":"valueObjValues"}

Sample Code:
{"func":"blockControlFor","values":[{"type":"string","value":"i"},{"type":"number","value":"0"},{"type":"wrapper","func":"valueOpSubtract","values":[{"type":"wrapper","func":"valueObjLength","values":[{"type":"wrapper","func":"valueList","name":"directory"}]},{"type":"number","value":1}]},{"type":"number","value":"1"}],"containers":[{"func":"blockObjDel","values":[{"type":"wrapper","func":"valueList","name":"directory"},{"type":"wrapper","func":"valueScriptVar","name":"i"}]}]} Add to my Backpack


{"func":"valueObjGet"}

Get Value Of

"Get Value Of" gets the value of the specified object.

Parameters:

Object: This is the object to get the value of. (Drag a variable/list block into this space.)

Key: This is the key/index of the variable. (Use 0-indexing.)

Related Blocks:
{"func":"blockObjSet"} ,     {"func":"blockObjDel"} ,     {"func":"valueObjLength"} ,     {"func":"valueObjKeys"} ,     {"func":"valueObjValues"}

Sample Code:
{"func":"blockControlFor","values":[{"type":"string","value":"i"},{"type":"number","value":"0"},{"type":"number","value":3},{"type":"number","value":"1"}],"containers":[{"func":"blockObjSet","values":[{"type":"wrapper","func":"valueList","name":"directory"},{"type":"wrapper","func":"valueScriptVar","name":"i"},{"type":"wrapper","func":"valueListNew"}],"next":{"func":"blockObjSet","values":[{"type":"wrapper","func":"valueObjGet","values":[{"type":"wrapper","func":"valueList","name":"directory"},{"type":"wrapper","func":"valueScriptVar","name":"i"}]},{"type":"string","value":"0"},{"type":"wrapper","func":"valueObjGet","values":[{"type":"wrapper","func":"valueVar","name":"fnames"},{"type":"wrapper","func":"valueScriptVar","name":"i"}]}]}}]} Add to my Backpack


{"func":"valueObjLength"}

Length Of

"Length Of" gets the length of the specified object.

Parameters:

Object: This is the object to get the length of. (Drag a variable/list block into this space.)

Related Blocks:
{"func":"blockObjSet"} ,     {"func":"valueObjGet"} ,     {"func":"blockObjDel"} ,     {"func":"valueObjLength"} ,     {"func":"valueObjKeys"} ,     {"func":"valueObjValues"}

Sample Code:
{"func":"blockControlFor","values":[{"type":"string","value":"i"},{"type":"number","value":"0"},{"type":"wrapper","func":"valueOpSubtract","values":[{"type":"wrapper","func":"valueObjLength","values":[{"type":"wrapper","func":"valueList","name":"directory"}]},{"type":"number","value":1}]},{"type":"number","value":"1"}],"containers":[{"func":"blockObjDel","values":[{"type":"wrapper","func":"valueList","name":"directory"},{"type":"wrapper","func":"valueScriptVar","name":"i"}]}]} Add to my Backpack


List Operators

{"func":"blockListAdd"}

Add

"Add" adds the object specified by the first parameter to the list specified by the second parameter.

Parameters:

Object: This parameter is the object you want to add to the specified list.

List: This parameter is the list that you want to add the specified object to.

Related Blocks:
{"func":"blockListDel"} ,     {"func":"blockListInsert"} ,     {"func":"blockListReplace"}

Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpNot","values":[{"type":"wrapper","func":"valueListContains","values":[{"type":"string","value":"ActorsHit"},{"type":"wrapper","func":"valueSensingTouchedActorName"}]}]}],"containers":[{"func":"blockListAdd","values":[{"type":"wrapper","func":"valueSensingTouchedActorName"},{"type":"string","value":"ActorsHit"}]}]}} Add to my Backpack


{"func":"blockListDel"}

Delete

"Delete" deletes the object of the specified index in the specified list. You can also delete ‘all’ objects or the ‘last’ object in the list.

Parameters:

Index: This parameter indicates the index of the object you want to remove from the specified list.

List: This parameter is the list that you want to remove the specified object from.

Related Blocks:
{"func":"blockListAdd"} ,     {"func":"blockListInsert"} ,     {"func":"blockListReplace"}

Sample Code:
{"func":"blockControlIf","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithSprite","values":[{"type":"string","value":"bottomedge"}]}],"containers":[{"func":"blockListDel","values":[{"type":"choice","value":"1"},{"type":"string","value":"ActorsHit"}]}]} Add to my Backpack


{"func":"blockListInsert"}

Insert

"Insert" inserts the object specified by the first parameter at the index specified by the second parameter of the list specified by the third parameter.

Parameters:

Object: This parameter is the object you want to add to the specified list.

Index: This parameter indicates the index that you want the specified object to be added at.

List: This parameter is the list that you want to add the specified object to.

Related Blocks:
{"func":"blockListAdd"} ,     {"func":"blockListDel"} ,     {"func":"blockListReplace"}

Sample Code:
{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueVar","name":"MyScore"},{"type":"wrapper","func":"valueListItem","values":[{"type":"choice","value":"1"},{"type":"string","value":"Players"}]}]}],"containers":[{"func":"blockListInsert","values":[{"type":"wrapper","func":"valueVar","name":"MyScore"},{"type":"choice","value":"1"},{"type":"string","value":"Players"}]}]} Add to my Backpack


{"func":"blockListReplace"}

Replace

"Replace" will replace the item at the index specified by the first parameter with the given object in the list specified by the second parameter.

Parameters:

Index: This parameter indicates the index that you want your new object to be added at. The object currently at this index will be removed.

List: This parameter is the list that you want to add the specified object to.

Object: This parameter is the object you want to add to the specified list.

Related Blocks:
{"func":"blockListAdd"} ,     {"func":"blockListDel"} ,     {"func":"blockListInsert"}

Sample Code:
{"func":"blockListReplace","values":[{"type":"choice","value":"1"},{"type":"string","value":"ActorsHit"},{"type":"wrapper","func":"valuePhysicsCollidedWithName"}]} Add to my Backpack


{"func":"valueListItem"}

Item

"Item" returns the item at the index specified by the first parameter of the given list.

Parameters:

Index: This parameter indicates the index that you want to retrieve an object from.

List: This parameter is the list that you want to retrieve and object from.

Related Blocks:
{"func":"valueListLength"} ,     {"func":"blockListReplace"}

Sample Code:
{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueVar","name":"MyScore"},{"type":"wrapper","func":"valueListItem","values":[{"type":"choice","value":"1"},{"type":"string","value":"Players"}]}]}],"containers":[{"func":"blockListInsert","values":[{"type":"wrapper","func":"valueVar","name":"MyScore"},{"type":"choice","value":"1"},{"type":"string","value":"Players"}]}]} Add to my Backpack


{"func":"valueListLength"}

Length

"Length" returns the length of the given list.

Parameters:

List: The method returns the length of this parameter, which should be an existing list.

Related Blocks:
{"func":"valueListItem"}

Sample Code:
{"func":"blockVarSet","values":[{"type":"string","value":"MyLetter"},{"type":"wrapper","func":"valueOpLetter","values":[{"type":"wrapper","func":"valueOpSubtract","values":[{"type":"wrapper","func":"valueObjLength","values":[{"type":"wrapper","func":"valueVar","name":"MyWord"}]},{"type":"number","value":"1"}]},{"type":"wrapper","func":"valueVar","name":"MyWord"}]}]} Add to my Backpack


{"func":"valueListContains"}

Contains

"Contains" returns true if the item specified by the first parameter contains the object specified by the second parameter.

Parameters:

List: This method checks if the specified object is in this list, and returns true if it is.

Object: This method checks if this object is in the specified list, and returns true if it is.

Related Blocks:
{"func":"valueListItem"}

Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpNot","values":[{"type":"wrapper","func":"valueListContains","values":[{"type":"string","value":"ActorsHit"},{"type":"wrapper","func":"valueSensingTouchedActorName"}]}]}],"containers":[{"func":"blockListAdd","values":[{"type":"wrapper","func":"valueSensingTouchedActorName"},{"type":"string","value":"Actors Hit"}]}]}} Add to my Backpack