This function will save a previously created DS map to a buffer. You supply the DS map ID value (as returned by the function ds_map_create) and the ID of the buffer to write to (as returned by the function buffer_create). Note that if the DS map being saved contains an array, this will be converted into a DS list instead when saved.
IMPORTANT! The secure saved DS map file can only be loaded on the device that created it, and if you try to load a file that was saved on a different device, then it will not work.
ds_map_secure_save_buffer(filename);
参数 | 描述 |
---|---|
id | The DS map ID value. |
buffer | The buffer ID value. |
Integer (DS map index)
buff = buffer_create(128,buffer_grow,4);
var map = ds_map_create();
ds_map_add(map,"bob","ajob");
ds_map_add(map,"money",10);
ds_map_secure_save_buffer(map, buff);
ds_map_destroy(map);
The above code will create a buffer and a DS map, then populate the map with some values and write it to the buffer before deleting the map.