Difference between revisions of "Lua:createMemoryStream"
Jump to navigation
Jump to search
(Created page with "<h3>Example 1</h3> <pre> m = createMemoryStream() m.Size = 8 m.Position = 0 print("addr: ", m.Memory) writeIntegerLocal(m.Memory, 1) print( readIntegerLocal(m.Memory) ) -- 1...") |
|||
Line 8: | Line 8: | ||
writeIntegerLocal(m.Memory, 1) | writeIntegerLocal(m.Memory, 1) | ||
+ | m.Position = m.Position + 4 | ||
+ | writeIntegerLocal(m.Memory+m.Position, -1) | ||
+ | |||
+ | m.Position = 0 | ||
print( readIntegerLocal(m.Memory) ) -- 1 | print( readIntegerLocal(m.Memory) ) -- 1 | ||
− | |||
m.Position = m.Position + 4 | m.Position = m.Position + 4 | ||
− | |||
print( readIntegerLocal(m.Memory+m.Position, true) ) -- -1 | print( readIntegerLocal(m.Memory+m.Position, true) ) -- -1 | ||
Revision as of 02:56, 28 August 2020
Example 1
m = createMemoryStream() m.Size = 8 m.Position = 0 print("addr: ", m.Memory) writeIntegerLocal(m.Memory, 1) m.Position = m.Position + 4 writeIntegerLocal(m.Memory+m.Position, -1) m.Position = 0 print( readIntegerLocal(m.Memory) ) -- 1 m.Position = m.Position + 4 print( readIntegerLocal(m.Memory+m.Position, true) ) -- -1 m.destroy()
Example 2
m = createMemoryStream() m.Size = 8 m.Position = 0 print("addr: ", m.Memory) m.writeDword(1) m.writeDword(-1) m.Position = 0 print( m.readDword() ) -- 1 print( m.readDword() ) -- 4294967295 m.destroy()