EngineStreamingGetBufferSize

From Multi Theft Auto: Wiki
Revision as of 23:32, 25 August 2023 by Pirulax (talk | contribs) (Created page with "__NOTOC__ {{Client function}} {{New feature/item|3.0160|1.6.0|21874|Get the streaming buffer size ['''not''' maximum memory size]}} ==Syntax== <syntaxhighlight lang="lua"> number engineStreamingGetBufferSize() </syntaxhighlight> {{OOP||EngineStreaming:setBufferSize|bufferSize|engineStreamingGetBufferSize}} ===Returns=== The streaming buffer size. It is always a positive non-zero number. ==Example== This example adds a command that can be used to change the streamin...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Get the streaming buffer size [not maximum memory size]

Syntax

number engineStreamingGetBufferSize()

OOP Syntax Help! I don't understand this!

Method: EngineStreaming:setBufferSize(...)
Variable: .bufferSize
Counterpart: engineStreamingGetBufferSize


Returns

The streaming buffer size. It is always a positive non-zero number.

Example

This example adds a command that can be used to change the streaming buffer size, and display the previous value.

addCommandHandler("sbs", function(_, sizeMB)
    if tonumber(sizeMB) then
        if engineStreamingSetBufferSize(tonumber(sizeMB) * 1024 * 1024) then -- Convert MB to Bytes
            outputChatbox("The streaming buffer size has been changed from " .. math.floor(engineStreamingGetBufferSize() / 1024 / 1024) .. " MB to " .. sizeMB .. " MB")
        else
            outputChatbox("Not enough memory!")
        end
    else
        outputChatbox("Please enter a numeric value!")
    end
end, false, false)

Requirements

Minimum server version n/a
Minimum client version 1.6.0-9.21874

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.6.0-9.21874" />

See Also