lua-users home
lua-l archive

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


Am 08.05.2014 17:24 schröbte Pierre-Yves Gérardy:
I doubt you can get an improvement with `load`.

     load"local a=..."

is three characters longer than

     function(a)end

You can cache the prologue in a variable, but two functions is too
little to gain from it:

L="local a,b,c=..."load(L.."")load(L.."")
function(a,b,c)endfunction(a,b)end

Yes, and we also rely on upvalues, so we would need the `function` keyword in there after all ...
But for a moment it was a good idea.

—Pierre-Yves

Philipp




On Thu, May 8, 2014 at 4:57 PM, Philipp Janda <siffiejoe@gmx.net> wrote:
Am 08.05.2014 15:47 schröbte Thiago L.:


I wonder if less than 239 chars is possible (maybe with some
load()/loadstring() trickery?)


Sure. Using Paul's trick I'm currently at 230 bytes (234 if you don't like
global `next`). But it's based on my original proposal, so you won't like it
...

But using `load` is an interesting idea (e.g. for avoiding the `function`
keyword) ...

Philipp