Files
node-metaverse/lib/classes/llsd/LLSDInteger.ts
2025-01-17 23:53:31 +00:00

34 lines
650 B
TypeScript

import type { BinaryReader } from "../BinaryReader";
export class LLSDInteger
{
private _int: number;
public constructor(int: number)
{
this._int = int;
}
public static parseBinary(reader: BinaryReader): LLSDInteger
{
return new LLSDInteger(reader.readUInt32BE());
}
public valueOf(): number
{
return this._int;
}
public toJSON(): number
{
return this._int;
}
public set value(newValue: number)
{
if (!Number.isInteger(newValue)) {
throw new Error("LLSDInteger must be an integer.");
}
this._int = newValue;
}
}