Add opcode implementation for data_deletealloflist

This commit is contained in:
Andrew Sliwinski 2018-07-11 13:14:01 -04:00
parent 250b164603
commit f7aafe4d9c

View file

@ -23,6 +23,7 @@ class Scratch3DataBlocks {
data_listcontents: this.getListContents, data_listcontents: this.getListContents,
data_addtolist: this.addToList, data_addtolist: this.addToList,
data_deleteoflist: this.deleteOfList, data_deleteoflist: this.deleteOfList,
data_deletealloflist: this.deleteAllOfList,
data_insertatlist: this.insertAtList, data_insertatlist: this.insertAtList,
data_replaceitemoflist: this.replaceItemOfList, data_replaceitemoflist: this.replaceItemOfList,
data_itemoflist: this.getItemOfList, data_itemoflist: this.getItemOfList,
@ -136,6 +137,13 @@ class Scratch3DataBlocks {
list._monitorUpToDate = false; list._monitorUpToDate = false;
} }
deleteAllOfList (args, util) {
const list = util.target.lookupOrCreateList(
args.LIST.id, args.LIST.name);
list.value = [];
return;
}
insertAtList (args, util) { insertAtList (args, util) {
const item = args.ITEM; const item = args.ITEM;
const list = util.target.lookupOrCreateList( const list = util.target.lookupOrCreateList(