示例#1
0
  @Override
  protected LuaChunk _read(DataSource source) throws IOException {
    int magic = source.getInt();
    if (magic != 0x1B4C7561) throw new IOException("Invalid LUA file");
    int version = source.getUByte();
    if (version != 0x31)
      throw new IOException("Invalid LUA file version: " + Integer.toHexString(version));
    if (source.getUByte() != 4) throw new IOException("Invalid LUA file, float length isn't 4...");

    source.skip(4); // Todo: wtf are these?

    LuaFunction lf = readFunction(source);

    // Todo: decompile? haha, if it'll be anything like the java decompiler I wrote then f**k that

    return new LuaChunk(source.container, source.getName(), lf);
  }