lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


on 9/17/04 12:00 PM, Luiz Henrique de Figueiredo at <lhf@tecgraf.puc-rio.br>
wrote:
>> Any way to get the source back?
> Sorry, no. The best you can do is run luac -l on the compiled files and
> read the bytecode, specially the comments -- they give you the names of the
> variables and the values of constants. Names of local variables will no
> appear, but you can recompile src/luac/print.c to show them. It's a simple
> switch. You'll still have to keep track of scopes by hand.
> 
> Bottom line: sorry, the source is gone forever. You may be able to recreate
> it, but it'll be hard work, specially since you have 60 files!

Actually only one file (the biggest one, the common library file!) got
tokenized. All the others are ASCII text. ;-)

I was able to do the "luac -l" trick to dump the tokens like this:

function <zebnig:2368> (11 instructions, 44 bytes at 0x11fc50)
1 param, 9 stacks, 0 upvalues, 5 locals, 2 constants, 0 functions
    1    [2369]    MOVE         1 0 0
    2    [2369]    LOADNIL      2 4 0
    3    [2369]    TFORPREP     1 5    ; to 9
    4    [2370]    GETGLOBAL    5 0    ; dprint
    5    [2370]    MOVE         6 3 0
    6    [2370]    LOADK        7 1    ; ":"
    7    [2370]    MOVE         8 4 0
    8    [2370]    CALL         5 4 1
    9    [2369]    TFORLOOP     1 0 1
    10    [2370]    JMP          0 -7    ; to 4
    11    [2372]    RETURN       0 1 0

But what would be the source for this function?

-- 
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)