lua-users home
lua-l archive

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

>From Mon Jul 19 13:31:59 1999
>From: Adam Wozniak <>

>Are there no "goto" or "label"s ?  Or did I just miss them?

No, there are no "goto"s or "label"s.
Do you *really* need them?

>Has any thought been given to reducing the size of Lua binaries?
>Binaries for an even modest size program seem to have a large number
>of duplicated strings in them (function names, variable names, etc...)
>which could be collapsed together.

Each function has its own constant table, which contains all the strings
(and global variable names) that are used within the function.
The parser tries minimize them, but not too hard.
To do a complete reduction, try luac -O.
However, even this does not cross function boundaries.

So, if several functions in a chunk use the same string, then yes it will
be duplicated. However, you can avoid this by using a global variable, or
a local variable and upvalues:

        local mystring1="......"
        local mystring2="xxxxxx"
        function f() return %mystring1,"1",%mystring2 end
        function g() return %mystring2,"2",%mystring1 end