Skip to content

Commit

Permalink
w.i.p: completing instances and updating changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
ffrostfall committed Mar 6, 2024
1 parent 433a6ba commit 1da2b8d
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 9 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ ByteNet uses [semantic versioning](https://semver.org/spec/v2.0.0.html).

---

## 0.4.0

### Improvements

-

---

## 0.4.0-rc3

### Added
Expand Down
6 changes: 3 additions & 3 deletions dev/client/clientTests.client.luau
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ local testPackets = require(ReplicatedStorage.shared.testPackets)
--print(data)
--end)

testPackets.myPacket.listen(function()
--print("Confirming server -> client")
--print(data)
testPackets.myPacket.listen(function(data)
print("Confirming server -> client")
print(data)
end)
--
task.wait(2)
4 changes: 2 additions & 2 deletions dev/server/serverTests.server.luau
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ end)

Players.PlayerAdded:Connect(function()
task.wait(1)
--[[testPackets.myPacket:sendToAll({ {
testPackets.myPacket.sendToAll({
myMessage = "",
} })]]
})
end)

testPackets.myPacket.listen(function(a)
Expand Down
5 changes: 1 addition & 4 deletions dev/shared/testPackets.luau
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ local ByteNet = require(ReplicatedStorage.Packages.ByteNet)
--
return ByteNet.defineNamespace("game", function()
local myStruct = ByteNet.struct({
a = ByteNet.uint8,
b = ByteNet.uint16,
c = ByteNet.string,
d = ByteNet.float32,
a = ByteNet.inst,
})

return {
Expand Down
28 changes: 28 additions & 0 deletions src/dataTypes/inst.luau
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
local bufferWriter = require(script.Parent.Parent.process.bufferWriter)
local types = require(script.Parent.Parent.types)

local reference = bufferWriter.reference
local alloc = bufferWriter.alloc

return function(): types.dataTypeInterface<Instance?>
return {
write = function(value)
alloc(1)
reference(value)
end,

read = function(b: buffer, cursor: number, references)
if not references then
return nil, 1
end

local ref = references[buffer.readu8(b, cursor)]

if typeof(ref) == "Instance" then
return ref, 1
else
return nil, 1
end
end,
}
end
6 changes: 6 additions & 0 deletions src/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ local buff = require(script.dataTypes.buff)
local cframe = require(script.dataTypes.cframe)
local float32 = require(script.dataTypes.float32)
local float64 = require(script.dataTypes.float64)
local inst = require(script.dataTypes.inst)
local int16 = require(script.dataTypes.int16)
local int32 = require(script.dataTypes.int32)
local int8 = require(script.dataTypes.int8)
local map = require(script.dataTypes.map)
local nothing = require(script.dataTypes.nothing)
local optional = require(script.dataTypes.optional)
local string = require(script.dataTypes.string)
local struct = require(script.dataTypes.struct)
local uint16 = require(script.dataTypes.uint16)
local uint32 = require(script.dataTypes.uint32)
local uint8 = require(script.dataTypes.uint8)
local unknown = require(script.dataTypes.unknown)
local vec2 = require(script.dataTypes.vec2)
local vec3 = require(script.dataTypes.vec3)
local namespace = require(script.namespaces.namespace)
Expand Down Expand Up @@ -56,5 +59,8 @@ return (
buff = buff(),
struct = struct,
map = map,
inst = inst(),
unknown = unknown(),
nothing = nothing(),
}) :: any
) :: types.ByteNet

0 comments on commit 1da2b8d

Please sign in to comment.