EngineStreamingGetMemorySize: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
m (incorrect function name)
 
(3 intermediate revisions by 3 users not shown)
Line 5: Line 5:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
number engineStreamingGetMemorySize()
int engineStreamingGetMemorySize()
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[EngineStreaming]]:getMemorySize|memorySize|engineStreamingSetMemorySize}}
{{OOP||[[EngineStreaming]]:getMemorySize|memorySize|engineStreamingSetMemorySize}}
Line 17: Line 17:
addCommandHandler("ssms", function(_, sizeMB)
addCommandHandler("ssms", function(_, sizeMB)
     if tonumber(sizeMB) then
     if tonumber(sizeMB) then
         outputChatbox("The maximum streaming memory available has been changed from " .. math.floor(engineGetStreamingMemorySize() / 1024 / 1024) .. " MB to " .. sizeMB .. " MB")       
         outputChatBox("The maximum streaming memory available has been changed from " .. math.floor(engineStreamingGetMemorySize() / 1024 / 1024) .. " MB to " .. sizeMB .. " MB")       
         engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes
         engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes
     else
     else
         outputChatbox("Please enter a numeric value!")
         outputChatBox("Please enter a numeric value!")
     end
     end
end, false, false)
end, false, false)
</syntaxhighlight>
</syntaxhighlight>
==Requirements==
{{Requirements|n/a|1.6.0-9.21874|}}


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

Latest revision as of 10:28, 1 January 2025

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

[[{{{image}}}|link=|]] Tip: The `showmemstat` command can be used to see this value in real-time [You might have to scroll down using PgDown on your keyboard]

Syntax

int 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(engineStreamingGetMemorySize() / 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)

See Also