lua-users home
lua-l archive

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

2012/6/6 Maha Akkari <>:

> I have two lua files in the same directory, file A.lua and B.lua. both
> files are identical except for their Id variable.
> (i.e. A.lua and B.lua have the same methods , however, A.lua has a variable
> id=1 and B.lua has variable id=2)
> ...
> any idea why is this happening ?

As Thijs warned, I'm just guessing … but I happen to enjoy
making this particular guess!

Is your code similar to this?

--- A.lua
id = "This is A"
return function() print(id) end
--- B.lua
id = "This is B"
return function() print(id) end

> A=require"A"
> B=require"B"
> A() --> This is B