Skip to content

v0.16.0

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 23 Feb 22:16

Feature

  • Overloaded len function for data sources (792657b)
obj["$length"] = len(storage.arr)
# execute store result score $length obj run data get storage name:path arr

storage.last_slot[Byte] = len(storage.Items) - 1
# execute store result score $i0 bolt.expr.temp run data get storage name:path Items
# execute store result storage name:path last_slot byte 1 run scoreboard players remove $i0 bolt.expr.temp 1
  • Add string data source indexing and slicing (4b5fa58)
# must specify the data type
message = storage.msg[str]

storage.a = message[5:]
# data modify storage name:path a set string storage name:path msg 5

storage.chars.append(message[0])
# data modify storage name:path chars append string storage name:path msg 0 1

message[0] = "c"
# TypeError: String data source does not support index/slice assignment.

storage.value[0] # list indexing
storage.value[0:5] # generic data sources dont accept slices

Fix

  • Add store result inlining rule (006750b)
  • Lazy sources should discard previous value when reused (2101335)