lua-users home
lua-l archive

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

On Mon, Jun 13, 2011 at 2:33 PM, Luiz Henrique de Figueiredo
<> wrote:
> All feedback welcome. Thanks.

o Is there a reason this idea [1] was scrapped?

o Also, since load is currently the only mechanism to set the _ENV
upvalue without using the debug API, I'd like to see a generator for
compiled chunks that let you set the _ENV upvalue:

function _main (_ENV)
  return function (...)
     --[[ chunk ]]

While this can be done by modifying the source of Lua code, it can't
be done with precompiled bytecode. Perhaps most importantly, this
allows us to create a new closure of a compiled function without
recompiling it (or reloading the bytecode). If I want to run the same
function in different threads with different environments, I would
need to re-compile it each time to create a new closure, currently.


- Patrick Donnelly