Loading a file normally has the same behaviour as before. First the cache is
checked and if nothing is found, the file is loaded and cached.
This commit changes the behaviour of loading a file uncached. This no longer
removes the file from the cache if it is cached (why should it?) and also does
not put it in the cache.
This means that users of load_uncached and load_uncached_silently can now freely
modify the resulting surface without interfering with other API users.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Before this, calling one of the loading functions with a nil argument always
made it return the default 0x0 surface. With this change, the passed-in default
value is now properly applied.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Previously, a Lua error was thrown when loading a file failed. Most callers are
not prepared for this and the result is less than optimal.
This commit makes the functions print the errors and return nil instead. For
callers that want to handle errors themselves, "_silent" variants of the
functions are introduced which just return errors to the caller.
Signed-off-by: Uli Schlachter <psychon@znc.in>