buffer_load

This function loads a buffer that was previously saved using the buffer_save functions, as well as any Included Files or other files stored externally.

It returns a new buffer which is created by the function as a "grow" buffer (see here) with a byte alignment of 1. The buffer should be stored in a variable and used in all further function calls to this buffer. If the load fails for whatever reason, the function will return -1 and a message will be shown in the compiler output window saying that the load has failed.

NOTE It's important that you remove any dynamically created resources like this from memory when you no longer need them to prevent memory leaks, so when you are finished with the buffer that you have created you should free it up again using buffer_delete.

Platform-specific notes

 

Syntax:

buffer_load(filename);

ArgumentTypeDescription
filenameStringThe name of the file to load from.

 

Returns:

Buffer

 

Example:

player_buffer = buffer_load("Player_Save.sav");

The above code loads a previously saved buffer into memory, creating a new buffer. It is stored in a variable player_buffer.