lua - Wrong constructor is called when two classes of the same name are in different files -
i'm new lua. co-worker asked me work code while he's on leave. i'm having problem couldn't find answer (or couldn't query right).
i have 2 lua scripts classes imitating types in our c program.
file , b both contain identical class typea:
type1 = { new = function(self,num) local o = { _data_num = {}, _data = {}, _size = {}, } o._data_num = num i=1, num o._data[i] = type2:new() end o._size = o._data[1]:getsize() setmetatable(o,self) return o end, <some other functions>
also both files contain class type2 bearing same name different code. both of them marked required in file c.
script crashed when instantiating type1 in file c because constructor wrong type2 called in process (from b instead of a).
can please offer me workaround?
putting files in different folders doesn't work.
Comments
Post a Comment