ACR_Wealth.ACR_Wealth.SaveScriptGlobals C# (CSharp) Method

SaveScriptGlobals() public method

This helper function saves the value of all 'globals' to an object array for use with storing a saved state (e.g. a script situation).
public SaveScriptGlobals ( ) : object[]
return object[]
        public object[] SaveScriptGlobals()
        {
            object[] Globals = new object[GlobalFields.Count];

            int i = 0;

            foreach (FieldInfo Field in GlobalFields)
            {
                Globals[i] = Field.GetValue(this);
                i += 1;
            }

            return Globals;
        }

Usage Example

        private ACR_Wealth([In] ACR_Wealth Other)
        {
            InitScript(Other);

            LoadScriptGlobals(Other.SaveScriptGlobals());
        }