On this page
packet.write
Writes a typed value into the payload.
Syntax
Atlas Script
packet.write(type, offset, value)Parameters
type- Numeric value type: "u8", "i8", "u16", "i16", "u32", "i32", "f32", or "f64", with an optional "be" suffix for big-endian.
offset- Byte offset into the packet. Payload-relative for packet.* methods, and absolute (whole IP packet) for the raw_* variants.
value- Value written, converted, or evaluated by this method. Its required type and range are described in Remarks.
Return value
See the remarks for the returned value and runtime behavior.
Remarks
Writes a typed value into the payload. Integer types truncate toward zero and wrap to the type's width, so -1 written as "u8" is 255; "f32" and "f64" store IEEE-754 values. Does nothing for an unknown type or when the value would run past the end of the packet.
Examples
Usage pattern
// Replace type, offset, value with values described above.
packet.write(type, offset, value);