lua-users home
lua-l archive

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




On Wed, Jun 17, 2009 at 12:42 AM, Norbert Kiesel <nkiesel@tbdnetworks.com> wrote: 
(...) I have a set of lua scripts that are constructed using
copy-n-paste of templates.  Something along these lines

local result = ''

local a, b = foo("bla bla")
... process a,b, append to overall result
result = result ..

local a, b = foo("rabarber rabarber")
... process a,b, append to overall result
result = result ..

report(result)

A typical script has between 1 and 5 of these blocks, and foo() talks to
another device and thus is really slow compared to the rest of the code.
So far I was always removing the "local" in front of all but the first
template.  Just wanted to make sure I don't do something stupid here by
leaving it.

</nk>

Sure, you'd have to have about a hundred of such blocks before it starts causing problems. I think what I would probably do is put the code blocks each inside a generic "do ... end" block.

-Duncan