Module core

Various free functions used by memory blobs.

Functions

ExistsInStorage (id) (WIP) Check whether an entry exists in storage.
GetBlobDispatcher () Get the dispatcher used by blob-related events, in order to add / remove listeners.
GetQueueReference (id, token) (WIP, in probation) Acquire a Lua process-local reference to a queue created by NewQueue.
IsBlob (object, type) Indicates whether an object is a MemoryBlob.
New (opts) Create a new memory blob.
NewQueue ([size=0]) (WIP, in probation) Create a new concurrent queue that may be enqueued and dequeued by multiple Lua processes.


Functions

ExistsInStorage (id)
(WIP) Check whether an entry exists in storage.

Parameters:

Returns:

    boolean The entry exists?
GetBlobDispatcher ()
Get the dispatcher used by blob-related events, in order to add / remove listeners.

Calling this outside Corona's main thread results in an error.

Returns:

    EventDispatcher Dispatcher.

See also:

GetQueueReference (id, token)
(WIP, in probation) Acquire a Lua process-local reference to a queue created by NewQueue.

Parameters:

  • id string Queue ID, as returned by NewQueue.
  • token string or nil If absent, a garden-variety queue reference is returned. Otherwise, may be "consumer" or "producer" to acquire the corresponding token-bearing reference.

Returns:

    ConsumerQueueRef, ProducerQueueRef, QueueRef or nil Queue reference, or nil on error, e.g. for invalid IDs.
IsBlob (object, type)
Indicates whether an object is a MemoryBlob.

Parameters:

  • object Object to check.
  • type optional string If present, refine the query to only consider blobs of a given type, cf. New.

Returns:

    boolean Is object a blob?
New (opts)
Create a new memory blob.

No assumptions should be made about the original contents; whatever the allocator provides is left intact.

Parameters:

  • opts table, uint or nil Blob creation options.

    When opts is a table, it may contain the following options:

    • alignment: If specified, the memory alignment, which must be a multiple of 2, ≥ 4. The blob's memory will start at an address that is a multiple of this value, which is useful and / or needed e.g. for SIMD operations. By default, blobs use the Lua allocator's alignment.

      Currently, the upper limit is 1024, one level beyond AVX2 support.
    • resizable: If true, the blob can be resized. Off by default.
    • size: Blob size in bytes, ≥ 0. For resizable blobs, this is the blob's initial size; otherwise, it specifies the fixed size. If absent, 0.
    • type: A string that will be used to name the blob userdata's metatable; if absent, uses a default.

      Blobs themselves make no further use of this value; rather it is exposed as a convenience, e.g. so plugin authors can identify their own blobs via IsBlob.

    If opts is an integer, it specifies the fixed size (≥ 0) of the blob to create.

    For any other value of opts, a resizable blob will be created.

Returns:

    MemoryBlob The new blob.
NewQueue ([size=0])
(WIP, in probation) Create a new concurrent queue that may be enqueued and dequeued by multiple Lua processes. (TODO: flesh out from library docs)

Parameters:

  • size uint Number of elements in a full queue, honored by some of the enqueue operations. A size of 0 will be given a reasonable default. (default 0)

Returns:

    string An ID referring to the queue, for later lookup by GetQueueReference.
generated by LDoc 1.4.6 Last updated 2019-08-20 13:37:59