Difference between revisions of "Lua:allocateMemory"
Jump to navigation
Jump to search
m |
m |
||
| Line 47: | Line 47: | ||
{{LuaSeeAlso}} | {{LuaSeeAlso}} | ||
| + | |||
| + | {{Memory}} | ||
Revision as of 14:54, 25 June 2026
Allocates memory in the target process.
The optional BaseAddress parameter can be used to specify a preferred base address for the allocation. The optional Protection parameter can be used to specify the memory protection for the allocated region.
Function Parameters
| Parameter | Type | Description |
|---|---|---|
| size | Integer | The number of bytes to allocate in the target process. |
| BaseAddress | Integer or CEAddressString (optional) | The preferred base address for the allocation. |
| Protection | Integer or String (optional) | The memory protection to use for the allocated region. |
Returns
integer — The address of the allocated memory block.
Examples
local address = allocateMemory(1024)
print("Allocated memory at: " .. string.format("%X", address))
deAlloc(address)
local baseAddress = getAddress("game.exe")
local address = allocateMemory(2048, baseAddress)
print("Allocated memory at: " .. string.format("%X", address))
deAlloc(address)