Click here to Skip to main content
15,892,161 members
Articles / Containers / Virtual Machine

Twiggery Scripting Language

Rate me:
Please Sign up or sign in to vote.
4.82/5 (14 votes)
12 Aug 2010LGPL313 min read 64.3K   1.1K   36  
Twiggery Scripting Language
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Windows.Forms;
using System.Drawing;
using System.Threading;
using System.Runtime.InteropServices;
using num = System.Single;
using arguments = System.Collections.Generic.List<object>;

namespace Twiggery.Plugin.Core
{
    public partial class Core
    {
        private static List<List<num>> listContainer = new List<List<num>>();

        public static void list_init(arguments args)
        {
            listContainer.Clear();
        }

        public static void list_new(arguments args)
        {
            int c = (int)(num)args[0];
            args.Clear();
            num result = (num)listContainer.Count;
            listContainer.Add(new List<num>());
            for (int i = 0; i < c; ++i)
            {
                listContainer[(int)result].Add((num)0);
            }
            args.Add(result);
        }

        public static void list_get(arguments args)
        {
            int index = (int)(num)args[0];
            int l = (int)(num)args[1];
            args.Clear();
            num result = listContainer[l][index];
            args.Add(result);
        }

        private static void list_set(arguments args)
        {
            num value = (num)args[0];
            int index = (int)(num)args[1];
            int l = (int)(num)args[2];
            args.Clear();
            listContainer[l][index] = value;
        }

        private static void list_add(arguments args)
        {
            num value = (num)args[0];
            int l = (int)(num)args[1];
            args.Clear();
            listContainer[l].Add(value);
        }

        private static void list_remove(arguments args)
        {
            int index = (int)(num)args[0];
            int l = (int)(num)args[1];
            args.Clear();
            listContainer[l].RemoveAt(index);
        }

        private static void list_clear(arguments args)
        {
            int l = (int)(num)args[0];
            args.Clear();
            listContainer[l].Clear();
        }

        public static void list_count(arguments args)
        {
            int l = (int)(num)args[0];
            args.Clear();
            num result = (num)listContainer[l].Count;
            args.Add(result);
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Architect
China China
Video game player & creator; Hardware geek & maker.

Comments and Discussions