I realised that by using WriteTable and ReadTable, I could save Object Oriented Programming Objects in Hollywood.
However, I also realised it probably is not that simple and came to conclusion that instead of trying out myself, there might be more than I figure out on myself, so better ask from you directly what things you think should be taken into consideration when saving OOP objects as tables to a file.
as an example, heres the basic code for my OOP object:
Code: Select all
function OOP:New()
o = {}
SetMetaTable(o, self)
self.__index = self
o.var = 1
Return(o)
endfunction
myoopobject = OOP:New()
Then I run another program and decide to use ReadTable to get this myoopobject to other program.
I Guess for example debugprint(myoopobject.var) would work just fine, printing out "1".
But suppose I have some other function, like myoopobject:MyFunc, I suppose that wouldnt work since thanks to SetMetaTable and self.__index commands, it would try to find the MyFunc from OOP:MyFunc, and since I loaded this myoopobject to a completely new program, OOP wouldnt exist, or am I right?
These kind of things came to my mind, that while I suppose I basically can save OOP Object using WriteTable, there might be some things like these that I need to take into consideration if planning on doing that.
So what all things should I take into consideration if I am using WriteTable/ReadTable to save/load OOP Object?