Code Monkey home page Code Monkey logo

luau-diasm's Introduction

luau-diasm

roblox luau bytecode format disassembler

doesn't currently support all opcodes that can be mapped to constants but i will be pushing updates :)

also currently will not output bytecode members past lineinfo if proto size > 0 because i haven't reversed lineinfo yet!

enjoy

to be used with a std::string passed to disassembler::disassemble, for example (main.cpp)

auto* d = new disassembler;
std::string bytecode = "01 02 05 70 72 69 6E 74 04 77 61 72 6E 01 05 00 00 01 0F A3 00 00 00 8C 02 01 00 8C 00 0A 00 8C 01 01 00 A8 00 09 00 A4 03 01 00 00 00 00 40 52 04 02 00 9F 03 02 01 A4 03 03 00 00 00 20 40 52 04 02 00 9F 03 02 01 8B 00 F7 FF 82 00 01 00 04 03 01 04 00 00 00 40 03 02 04 00 00 20 40 00 00 01 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 01 00 00 00 00 00";
d->disassemble(bytecode);
delete d;

example disassembly looks like

number of protos: 1
maxstacksize: 5
numparams: 0
nups: 0
isvararg: 1

[001] CLEARSTACK      00 00 00
[002] LOADNUMBER      02 01 00 ; 1
[003] LOADNUMBER      00 10 00 ; 10
[004] LOADNUMBER      01 01 00 ; 1
[005] FORPREP         00 09 00 ; to 14
[006] OGETENV         03 01 00 ; print
[007] PSEUDO          00 00 64
[008] MOVE            04 02 00
[009] CALL            03 02 01
[010] OGETENV         03 03 00 ; print
[011] PSEUDO          00 32 64
[012] MOVE            04 02 00
[013] CALL            03 02 01
[014] FORLOOP         00 -9 -1 ; to 5
[015] RETURN          00 01 00

sizek: 4
sizep: 0
proto pool index: 0
lineinfo format: 1
lineinfo size: 24
should be 0: 0
head proto index: 0

luau-diasm's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.