Skip to content

Commit

Permalink
fix: writtebuffer not support sign integer
Browse files Browse the repository at this point in the history
  • Loading branch information
dulingzhi committed Aug 23, 2021
1 parent 255dace commit 126cb86
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/lua/core/object.lua
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ function createDefinition(defType, id, superId)
if type(id) == 'number' then
id = string.pack('>I', id)
end
if type(superId) == 'number' then
superId = string.pack('>I', superId)
end

if CREATED_DEFINITIONS[id] then
error(string.format('%s already exists', id), 2)
Expand Down
4 changes: 2 additions & 2 deletions src/lua/core/writebuffer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ function WriteBuffer:addChar(value)
end

function WriteBuffer:addInt(value)
self:add(string.pack('I4<', value))
self:add(string.pack('i4<', value))
end

function WriteBuffer:addShort(value)
self:add(string.pack('I2<', value))
self:add(string.pack('i2<', value))
end

function WriteBuffer:addFloat(value)
Expand Down

0 comments on commit 126cb86

Please sign in to comment.