lua-users home
lua-l archive

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

> I do like locals but local to a do-end blocks or functions not
> necessary files. So here is a simple use case.

Let's see again your first example:

> (file oneVar.lua)
> local x = 1
> (file simpleTest.lua)
> print("starting")
> dofile("oneVar.lua")
> print(x)
> print("the end")

You have to see dofile("oneVar.lua") as:


Also, dofile is done at runtime, not at compile time, so when you load simpleTest.lua, the compiler don't know that there is a local variable x defined in oneVar.lua.

Julien D.