EngineStreamingGetMemorySize: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Client function}} {{New feature/item|3.0160|1.6.0|21946|Gets the maximum amount of RAM [in bytes] that can be used for streaming}} ==Syntax== <syntaxhighlight lang="lua"> number engineStreamingGetMemorySize() </syntaxhighlight> {{OOP||EngineStreaming:getMemorySize|memorySize|engineStreamingSetMemorySize}} ==Returns== The maximum amount of RAM [in bytes] that can be used for streaming. It is always a non-zero positive number. ==Example== This example add...")
 
(Change build number to the correct value)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Client function}}
{{New feature/item|3.0160|1.6.0|21946|Gets the maximum amount of RAM [in bytes] that can be used for streaming}}
{{New feature/item|3.0160|1.6.0|21874|Gets the maximum amount of RAM [in bytes] that can be used for streaming}}
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 25: Line 25:


==Requirements==
==Requirements==
{{Requirements|n/a|1.6.0-9.21946|}}
{{Requirements|n/a|1.6.0-9.21874|}}


==See Also==
==See Also==
{{Engine functions}}
{{Engine functions}}

Revision as of 23:20, 25 August 2023

Gets the maximum amount of RAM [in bytes] that can be used for streaming

Syntax

number engineStreamingGetMemorySize()

OOP Syntax Help! I don't understand this!

Method: EngineStreaming:getMemorySize(...)
Variable: .memorySize
Counterpart: engineStreamingSetMemorySize


Returns

The maximum amount of RAM [in bytes] that can be used for streaming. It is always a non-zero positive number.

Example

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

addCommandHandler("ssms", function(_, sizeMB)
    if tonumber(sizeMB) then
        outputChatbox("The maximum streaming memory available has been changed from " .. math.floor(engineGetStreamingMemorySize() / 1024 / 1024) .. " MB to " .. sizeMB .. " MB")      
        engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes
    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