Skip to main content

encode_script

Function encode_script 

Source
pub fn encode_script(script: &CompiledScript) -> Vec<u8> ⓘ
Expand description

Encode a single compiled script to the CS2 Neptune binary format.

Layout:

  [header]  scriptName\0 + sourceFilePath\0 + lookupKey(i32) +
            paramTypeCount(u8) + paramTypes(u8[]) +
            lineTableLen(u16) + lineTable(pc+line pairs)
  [instrs]  per-instruction: opcode(u16) + operand (variable)
  [trailer] _instructions(i32) + intLocals(u16) + strLocals(u16) +
            intArgs(u16) + strArgs(u16) + switches(u8) + tables...
  [last2]   trailerLen(u16)