net/WriteUInt

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Added description and bit table.)
(Changed the description for net.WriteInt. So users know it supports both positive and negative numbers.)
 
Line 2: Line 2:
 
|Description=Appends an unsigned integer with the specified number of bits to the current net message.
 
|Description=Appends an unsigned integer with the specified number of bits to the current net message.
 
{{Note|Unsigned numbers does not support negative numbers.}}
 
{{Note|Unsigned numbers does not support negative numbers.}}
Use {{LibraryFunction|net|WriteInt}} to send negative numbers. Use {{LibraryFunction|net|WriteFloat}} for a non-whole number (e.g. 2.25).
+
Use {{LibraryFunction|net|WriteInt}} if you want to send positive and negative numbers. Use {{LibraryFunction|net|WriteFloat}} for a non-whole number (e.g. 2.25).
 
|Realm=Shared
 
|Realm=Shared
 
|IsClass=No
 
|IsClass=No

Latest revision as of 12:49, 16 January 2020

 net.WriteUInt( )

Description

Appends an unsigned integer with the specified number of bits to the current net message.

NOTE

Unsigned numbers does not support negative numbers.

Use net.WriteInt if you want to send positive and negative numbers. Use net.WriteFloat for a non-whole number (e.g. 2.25).

Arguments

number unsignedInteger

The unsigned integer to be sent.

Arguments

number numberOfBits

The size of the integer to be sent, in bits. Acceptable values range from any number 1 to 32 inclusive. For reference, 1 = bit, 4 = nibble, 8 = byte, 16 = short, 32 = long.
Consult the table below to determine the bit count you need. Minimum value is 0.
Bit Count Maximum value
1 1
2 3
3 7
4 15
5 31
6 63
7 127
8 255
9 511
10 1023
11 2047
12 4095
13 8191
14 16383
15 32767
16 65535
17 131071
18 262143
19 524287
20 1048575
21 2097151
22 4194303
23 8388607
24 16777215
25 33554431
26 67108863
27 134217727
28 268435455
29 536870911
30 1073741823
31 2147483647
32 4294967295
Personal tools
Navigation