load_image_asynch

declaration:

load_image_asynch(resource, [callback] ) => VID

Loads a resource as an image asynchronously. If a [callback] function is specified, otherwise a video_event will be emitted, it will be invocated when the image status is changed -- either loaded or failed.

The callback function is expected to look like:

function imageload_cb(sourcevid, statustbl)
    statustbl.kind == "load_failed" or "loaded"
    statustbl.width == image actual width
    statustbl.height == image actual height
end

**example use:**

vid = load_image_asynch(resource, function(source, statuslbl)
if
);
show_image(vid);
~~~~

related functions:
[load_image_asynch]

caveats:
Same as [load_image], but also that there's no argument for specifying order, [order_image] have to be called explicitly. Before the callback has been called the first time, surface storage properties are undefined.

Some functions, like an external launch, may force an asynchronous push, forcing the image to load fully before proceeding.

Any error that would have forced [load_image] to return BADID, will result in a blank (32x32) texture.


Related

Wiki: Video Functions
Wiki: load_image
Wiki: load_image_asynch
Wiki: order_image

MongoDB Logo MongoDB