Skip to content

Commit

Permalink
Fixed an issue with optional instances
Browse files Browse the repository at this point in the history
  • Loading branch information
1Axen committed Feb 21, 2024
1 parent 04fefb1 commit 7fb7f0f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Generator/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ end
--> Generator functions
function Generators.Optional(Declaration: Type, Read: Blocks.Block, Write: Blocks.Block, Variable: string): (Blocks.Block, Blocks.Block)
if Declaration.Type == "TypeDeclaration" and Declaration.Value.Primitive == "Instance" then
Read = Read:Compare("RecieveInstances[RecieveInstanceCursor]", "false", "Not")
Read = Read:Compare("typeof(RecieveInstances[RecieveInstanceCursor])", "\"Instance\"", "Equals")
else
Types.u8.Write(`{Variable} ~= nil and 1 or 0`, Write)
Read = Read:Compare(`buffer.readu8(RecieveBuffer, Read(1))`, "1", "Equals")
Expand Down

0 comments on commit 7fb7f0f

Please sign in to comment.