该函数将替换另一个给定位置的值。
警告 尝试替换越界位置的项目会导致错误,例如 ds_list_replace :: Trying to access an out-of-bounds index [| 4]。
ds_list_replace(id, pos, val);
参数 | 类型 | 描述 |
---|---|---|
id | DS List | 要更改的列表的ID。 |
pos | Real | 替换值的位置,其中0对应于列表的最初位置,最终位置为ds_list_size(id)-1。 |
val | Any | 要将给定值替换为的新值。 |
N/A
ds_list_replace(n_list, 3, name);
对于存储在变量"name"中的值,上述代码将替换列表中位置3处存储的值。