lua-users home
lua-l archive

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


On Fri, Jul 2, 2010 at 9:55 AM, Valerio Schiavoni
<valerio.schiavoni@gmail.com> wrote:
> hello Jerome
>
> On Fri, Jul 2, 2010 at 10:34 AM, Jerome Vuarand
> <jerome.vuarand@gmail.com> wrote:
>> Why do you need to merge the files ? What about conflicts between
>> globals and locals (ie. the top file define a local foo, while the
>> bottom file assumed it was a global) ?
>
> That's why I want to make a rewrite:
>
> --a.lua
> foo={}
>
> --b.lua
> local foo={}
>
> --merged.lua
> a_foo={}
> local b_foo={}
>
>
> Maybe there are some caveats I don't see in this approach.
>
> I need to merge lua files because we need to support 'submission of
> jobs' which are made by multiple files. The architecture is quite
> complex, you can read more here:
> http://www.splay-project.org/index.php?page=documentation
>

Wouldn't it be simpler to wrap a.lua and b.lua in generic "do" blocks?

 do
   -- a.lua
   local localorglobal = 100
 end
 do
   -- b.lua
    localorglobal = 1000
 end

...in fact, thinking about it, I don't think you'd technically need to
do it for b.lua, but it doesn't hurt.

-Duncan