[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: I ask a lua to call a function from file A.lua, instead, it calls it from file B.lua
- From: Maha Akkari <maha.akkari@...>
- Date: Thu, 7 Jun 2012 00:53:26 +0300
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 !!!