ByteNet Snippets for VSCode!

Hello Community :wave:

I made some snippets for those scripters who use ByteNet in VSCode. Hope this is usefull for y’all!

	"Bytenet Namespace": {
		"prefix": "namespace",
		"body": [
			"local ByteNet = require(script.Parent.Parent.ByteNet)",
			"",
			"return ByteNet.defineNamespace(\"${TM_FILENAME_BASE}\", function()",
			"\treturn {}",
			"end)",
			""
		],
		"description": "Creates a bytenet namespace for packets"
	},

	"Reliable Bytenet Packet": {
		"prefix": "packetr",
		"body": [
			"${1:PacketName} = ByteNet.definePacket({",
			"\tvalue = ${2:ByteNet.struct()},",
			"}),",
		],
		"description": "Creates a reliable packet structure"
	},

	"Unreliable Bytenet Packet": {
		"prefix": "packetu",
		"body": [
			"${1:PacketName} = ByteNet.definePacket({",
			"\tvalue = ${2:ByteNet.struct()},",
			"\treliabilityType = \"unreliable\",",
			"}),",
		],
		"description": "Creates an unreliable packet structure"
	},

	// All datatypes in ByteNet are prefixed with a 'b' before the name
	"ByteNet i8 Type": {
		"prefix": "bi8",
		"body": "ByteNet.int8",
		"description": "Inserts the i8 datatype"
	},

	"ByteNet array Type": {
		"prefix": "barray",
		"body": "ByteNet.array(${1:DataType})",
		"description": "Inserts the array datatype"
	},

	"ByteNet bool Type": {
		"prefix": "bbool",
		"body": "ByteNet.bool",
		"description": "Inserts the bool datatype"
	},

	"ByteNet buff Type": {
		"prefix": "bbuff",
		"body": "ByteNet.buff",
		"description": "Inserts the buff datatype"
	},

	"ByteNet cframe Type": {
		"prefix": "bcframe",
		"body": "ByteNet.cframe",
		"description": "Inserts the cframe datatype"
	},

	"ByteNet float32 Type": {
		"prefix": "bf32",
		"body": "ByteNet.float32",
		"description": "Inserts the float32 datatype"
	},

	"ByteNet float64 Type": {
		"prefix": "bf64",
		"body": "ByteNet.float64",
		"description": "Inserts the float64 datatype"
	},

	"ByteNet inst Type": {
		"prefix": "binst",
		"body": "ByteNet.inst",
		"description": "Inserts the inst datatype"
	},

	"ByteNet int16 Type": {
		"prefix": "bi16",
		"body": "ByteNet.int16",
		"description": "Inserts the int16 datatype"
	},

	"ByteNet int32 Type": {
		"prefix": "bi32",
		"body": "ByteNet.int32",
		"description": "Inserts the int32 datatype"
	},

	"ByteNet map Type": {
		"prefix": "bmap",
		"body": "ByteNet.map(${1:key}, ${2:value})",
		"description": "Inserts the map datatype"
	},

	"ByteNet nothing Type": {
		"prefix": "bnothing",
		"body": "ByteNet.nothing",
		"description": "Inserts the nothing datatype"
	},

	"ByteNet optional Type": {
		"prefix": "boptional",
		"body": "ByteNet.optional(${1:Value})",
		"description": "Inserts the optional datatype"
	},

	"ByteNet string Type": {
		"prefix": "bstring",
		"body": "ByteNet.string",
		"description": "Inserts the string datatype"
	},

	"ByteNet struct Type": {
		"prefix": "bstruct",
		"body": "ByteNet.struct({})",
		"description": "Inserts the struct datatype"
	},

	"ByteNet uint16 Type": {
		"prefix": "bui16",
		"body": "ByteNet.uint16",
		"description": "Inserts the uint16 datatype"
	},

	"ByteNet uint32 Type": {
		"prefix": "bui32",
		"body": "ByteNet.uint32",
		"description": "Inserts the uint32 datatype"
	},

	"ByteNet uint8 Type": {
		"prefix": "bui8",
		"body": "ByteNet.uint8",
		"description": "Inserts the uint8 datatype"
	},

	"ByteNet unknown Type": {
		"prefix": "bunknown",
		"body": "ByteNet.unknown",
		"description": "Inserts the unknown datatype"
	},

	"ByteNet vec2 Type": {
		"prefix": "bvec2",
		"body": "ByteNet.vec2",
		"description": "Inserts the vec2 datatype"
	},

	"ByteNet vec3 Type": {
		"prefix": "bvec3",
		"body": "ByteNet.vec3",
		"description": "Inserts the vec3 datatype"
	}

Learn how to Create Custom Snippets in VSCode.

If this was helpful and you liked it, pls leave a like to the topic!

DataType Snippet Result
array barray ByteNet.array(v)
bool bbool ByteNet.bool
buff bbuff ByteNet.buff
cframe bcframe ByteNet.cframe
float32 bf32 ByteNet.float32
float64 bf64 ByteNet.float64
instance binst ByteNet.inst
int16 bi16 ByteNet.int16
int32 bi32 ByteNet.int32
int8 bi8 ByteNet.int8
map bmap ByteNet.map(k, v)
nothing bnothing ByteNet.nothing
optional boptional ByteNet.optional(v)
string bstring ByteNet.string
struct bstruct ByteNet.struct({})
uint16 bui16 ByteNet.uint16
uint32 bui32 ByteNet.uint32
uint8 bui8 ByteNet.uint8
unknown bunknown ByteNet.unknown
vector2 bvec2 ByteNet.vec2
vector3 bvec3 ByteNet.vec3

Showcase of the Snippets

namespace Snippet

packetr & packetu Snippets

Datatypes Snippets

Report bugs

If something fails or is wrong, please comment it :pray:

Have a good day!

4 Likes