Beispiel #1
0
        internal static T GetFromIndexMethod <T>(ILSObject Obj, string MethodName, string LSTypeName, int number, params string[] Args)
        {
            // argument is 0-based
            number += 1;

            if (Obj == null || !Obj.IsValid || number <= 0)
            {
                return(default(T));
            }

            LavishScriptObject Index = LavishScript.Objects.NewObject("index:" + LSTypeName);

            string[] allargs = PrefixArray <string>(Index.LSReference, Args);

            Obj.ExecuteMethod(MethodName, allargs);

            LavishScriptObject used = Index.GetMember("Used");

            // if it failed or we want one off the end, return
            if (LavishScriptObject.IsNullOrInvalid(used) || used.GetValue <int>() < number)
            {
                return(default(T));
            }

            return(GetIndexMember <T>(Index, number));
        }
Beispiel #2
0
        internal static T GetFromIndexMember <T>(ILSObject Obj, string MemberName, string LSTypeName, int number, params string[] Args)
        {
            // argument is 0-based
            number += 1;

            if (Obj == null || !Obj.IsValid)
            {
                return(default(T));
            }

            LavishScriptObject Index = LavishScript.Objects.NewObject("index:" + LSTypeName);

            string[] allargs = PrefixArray <string>(Index.LSReference, Args);

            LavishScriptObject retval = Obj.GetMember(MemberName, allargs);

            if (LavishScriptObject.IsNullOrInvalid(retval) || retval.GetValue <int>() < number)
            {
                return(default(T));
            }

            return(GetIndexMember <T>(Index, number));
        }