i have a physic.lua script and i want to use it in player and enemy game object.
so, i wrote te next line in they controller script
local physics = require ("path")
but the problem is that i overwrite the local variables in physics.lua.
-- in player script
local pyshics1 = require("path")
physics1.a = 1
-- in enemy script
local pyshics2 = require("path")
physics2.a = 2
--then when i want to get the value i got something like this
-- in player script
physics1.get_a() -- Value : 2
-- in enemy script
physics2.get_a() -- Value: 2
in java i would solve it using something like this
-- in player
Physics physics1= new Physics();
physic1.set_a(1);
-- in enemy
Physycs physics2 = new Physics();
physic.2_set_a(2)
--then
-- in player
physics1.get_a() -- Value: 1
-- in enemy
physics2.get_a() -- Value: 2
so, how can i do that ? two diferent instance of the same script ?