lua-users home
lua-l archive

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


i  made a mistake in explaining my problem, kindly replace lines 7,8,9 by the below

I have a c file that has two methods:
1- getID_of_A( ) that calls getID( ) of  A.lua,
2- getID_of_B ( ) that calls  getID( ) of B.lua.


On Thu, Jun 7, 2012 at 12:53 AM, Maha Akkari <maha.akkari@gmail.com> wrote:
Hello,

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)

in particular, A.lua and B.lua have  a method called : getID( )  that return the value of the id variable.

I have a c file that has two methods:
1- getID_of_A( ) then getID_of_B( ) calls getID( ) of  A.lua,
2- getID_of_B ( ) calls  getID( ) of B.lua.

in both methods, i open a lua state, open libs, then call getglobal("GetID") and then i close the state.

in main of the C file, , i call method getID_of_A( ) then getID_of_B( ), both return the value 1 , which is the id of variable in A.lua.
I tried to change the value of id in A.lua to 4, and then called getID_of_A( ) then getID_of_B( ), both returned 4 !

any idea why is this happening ?
kindly note that in getID_of_A( )and getID_of_B( ), i opened lua states of different names andi made sure to close them at the end of each method ! please help !!!



--
--------------------------------------------------------------------------------------------
Facebook : akkari.maha

"Never Look down on people unless you are helping them get up"