Notifications
Clear all

[Closed] Shared struct: global or not?

Got your point, thanks
Your approach is way more structured than mine: I used to work very roughly on my scripts.

I see that your maxscript (and by you I mean all of you guys) is very refined: closer to hardcore programming than to quick-and-dirt scripting… Never suspected that maxscript could allow this kind of complexity. I’d like to learn more but I think it’s more a matter of general O-O programming knowledge, unrelated to a specific language.
I’ll try different ways and one day I hope to have reached a personal (but good) style… And maybe I could share with you some of my tools/experiments!

You mean all struct definitions in a single file?
Don’t you risk to have a mess of code lines in time?
Elsewhere was adviced to use basically an array of already included filenames, checked to avoid redefinitions and re-include.
I tried instead with a try-catch: I tried an access to the global instance… If I got an exception I included the appropriate file, else do nothing

Hi all! I’m still pondering on this stuff during my spare time ’cause I want to understand well and store everything on my memory!
I’m here right now to ask another question…and I’m afraid this could be stupid but… I have to! ;
I think I’ve got the main idea to declare the global var, define the struct in a local scope and then create an instance in the global var…
Local scope definition of the struct I think protects it from accidentaly conflicts at global level and stuff like that… Bu I admit I didn’t fully got one thing: why store the definition of a struct? And whatcit means that “this way nobody can modify it”?
I didn’t even though were possible to change defined struct…
As far I understood, if the definition of myStruct is local,is not possible to create instances outside the scope with a simple
my_new_instance = myStruct()
So I need a workaround… And this is to store useful informations to create an instance (aka the deginition) and use it to do that. This is done with a function callable from the main,global instance.
Is my understanding of the subject correct?

Page 2 / 2