CreateFunction() public method

public CreateFunction ( ScorpioHandle value ) : ScriptFunction
value ScorpioHandle
return ScriptFunction
 public static void Load(Script script)
 {
     ScriptTable Table = script.CreateTable();
     Table.SetValue("encode", script.CreateFunction(new encode()));
     Table.SetValue("decode", script.CreateFunction(new decode(script)));
     script.SetObjectInternal("json", Table);
 }
 public static void Load(Script script) {
     ScriptTable Table = script.CreateTable();
     Table.SetValue("count", script.CreateFunction(new count(script)));
     Table.SetValue("isparams", script.CreateFunction(new isparams(script)));
     Table.SetValue("isstatic", script.CreateFunction(new isstatic(script)));
     Table.SetValue("getparams", script.CreateFunction(new getparams(script)));
     script.SetObjectInternal("func", Table);
 }
 void OnGUI()
 {
     text = GUI.TextArea(new Rect(0, 0, width, windowHeight), text);
     url = GUI.TextField(new Rect(0, windowHeight, width, 30), url);
     PlayerPrefs.SetString("__Text", text);
     PlayerPrefs.SetString("__Url", url);
     if (GUI.Button(new Rect(0, windowHeight + 30, width / 2, 60), "RunScript (" + Script.Version + ")"))
     {
         output = "";
         Script script = new Script();
         try {
             script.LoadLibrary();
             script.PushAssembly(GetType().Assembly);
             script.PushAssembly(typeof(GameObject).Assembly);
             script.SetObject("print", script.CreateFunction(print));
             ScriptObject ret = script.LoadString(text);
             OutPut("ReturnValue : " + ret);
         } catch (System.Exception e) {
             OutPut("StackInfo : " + script.GetStackInfo());
             OutPut(e.ToString());
         }
     }
     if (GUI.Button(new Rect(width / 2, windowHeight + 30, width / 2, 60), "GetScript"))
     {
         SendMessage("GetScript");
     }
     GUI.TextArea(new Rect(0, windowHeight + 90, width, windowHeight), output);
 }
Example #4
0
 public static void Load(Script script) {
     ScriptTable Table = script.CreateTable();
     Table.SetValue("file_exist", script.CreateFunction(new file_exist()));
     Table.SetValue("path_exist", script.CreateFunction(new path_exist()));
     Table.SetValue("create_path", script.CreateFunction(new create_path()));
     Table.SetValue("create_file", script.CreateFunction(new create_file()));
     Table.SetValue("get_file", script.CreateFunction(new get_file()));
     Table.SetValue("del_file", script.CreateFunction(new del_file()));
     Table.SetValue("get_filelist", script.CreateFunction(new get_filelist(script)));
     script.SetObject("io", Table);
 }
        public static void Load(Script script)
        {
            ScriptTable Table = script.CreateTable();
            Table.SetValue("count", script.CreateFunction(new count()));
            Table.SetValue("clear", script.CreateFunction(new clear()));
            Table.SetValue("remove", script.CreateFunction(new remove()));
            Table.SetValue("containskey", script.CreateFunction(new containskey()));
			Table.SetValue("keys", script.CreateFunction(new keys()));
			Table.SetValue("values", script.CreateFunction(new values()));
            script.SetObjectInternal("table", Table);
        }
        public static void Load(Script script) {
            ScriptTable Table = script.CreateTable();
			Table.SetValue("PI", script.CreateDouble(PI));
			Table.SetValue("Deg2Rad", script.CreateDouble(Deg2Rad));
			Table.SetValue("Rad2Deg", script.CreateDouble(Rad2Deg));
			Table.SetValue("Epsilon", script.CreateDouble(Epsilon));
			Table.SetValue("min", script.CreateFunction(new min()));
			Table.SetValue("max", script.CreateFunction(new max()));
			Table.SetValue("abs", script.CreateFunction(new abs()));
			Table.SetValue("floor", script.CreateFunction(new floor()));
			Table.SetValue("clamp", script.CreateFunction(new clamp()));
			Table.SetValue("sqrt", script.CreateFunction(new sqrt()));
			Table.SetValue("pow", script.CreateFunction(new pow()));
            script.SetObjectInternal("math", Table);
        }
 public static void Load(Script script)
 {
     ScriptTable Table = script.CreateTable();
     Table.SetValue("format", script.CreateFunction(new format()));
     Table.SetValue("substring", script.CreateFunction(new substring()));
     Table.SetValue("length", script.CreateFunction(new length()));
     Table.SetValue("tolower", script.CreateFunction(new tolower()));
     Table.SetValue("toupper", script.CreateFunction(new toupper()));
     Table.SetValue("trim", script.CreateFunction(new trim()));
     Table.SetValue("replace", script.CreateFunction(new replace()));
     Table.SetValue("isnullorempty", script.CreateFunction(new isnullorempty()));
     Table.SetValue("indexof", script.CreateFunction(new indexof()));
     Table.SetValue("lastindexof", script.CreateFunction(new lastindexof()));
     Table.SetValue("startswith", script.CreateFunction(new startswith()));
     Table.SetValue("endswith", script.CreateFunction(new endswith()));
     Table.SetValue("contains", script.CreateFunction(new contains()));
     script.SetObjectInternal("string", Table);
 }
        public static void Load(Script script)
        {
            script.SetObjectInternal("print", script.CreateFunction(new print()));
            script.SetObjectInternal("pairs", script.CreateFunction(new pairs(script)));
            script.SetObjectInternal("kpairs", script.CreateFunction(new kpairs(script)));
            script.SetObjectInternal("vpairs", script.CreateFunction(new vpairs(script)));
            script.SetObjectInternal("type", script.CreateFunction(new type()));
            script.SetObjectInternal("is_null", script.CreateFunction(new is_null()));
            script.SetObjectInternal("is_bool", script.CreateFunction(new is_bool()));
            script.SetObjectInternal("is_number", script.CreateFunction(new is_number()));
            script.SetObjectInternal("is_double", script.CreateFunction(new is_double()));
            script.SetObjectInternal("is_long", script.CreateFunction(new is_long()));
            script.SetObjectInternal("is_int", script.CreateFunction(new is_int()));
            script.SetObjectInternal("is_string", script.CreateFunction(new is_string()));
            script.SetObjectInternal("is_function", script.CreateFunction(new is_function()));
            script.SetObjectInternal("is_array", script.CreateFunction(new is_array()));
            script.SetObjectInternal("is_table", script.CreateFunction(new is_table()));
            script.SetObjectInternal("is_enum", script.CreateFunction(new is_enum()));
            script.SetObjectInternal("is_userdata", script.CreateFunction(new is_userdata()));
            script.SetObjectInternal("branchtype", script.CreateFunction(new branchtype()));
            script.SetObjectInternal("typeof", script.CreateFunction(new userdatatype()));
            script.SetObjectInternal("tonumber", script.CreateFunction(new tonumber(script)));
            script.SetObjectInternal("tosbyte", script.CreateFunction(new tosbyte(script)));
            script.SetObjectInternal("tobyte", script.CreateFunction(new tobyte(script)));
            script.SetObjectInternal("toshort", script.CreateFunction(new toshort(script)));
            script.SetObjectInternal("toushort", script.CreateFunction(new toushort(script)));
            script.SetObjectInternal("toint", script.CreateFunction(new toint(script)));
            script.SetObjectInternal("touint", script.CreateFunction(new touint(script)));
            script.SetObjectInternal("tolong", script.CreateFunction(new tolong(script)));
            script.SetObjectInternal("toulong", script.CreateFunction(new toulong(script)));
            script.SetObjectInternal("tofloat", script.CreateFunction(new tofloat(script)));
            script.SetObjectInternal("toenum", script.CreateFunction(new toenum(script)));
            script.SetObjectInternal("tostring", script.CreateFunction(new tostring(script)));
            script.SetObjectInternal("clone", script.CreateFunction(new clone()));
            script.SetObjectInternal("require", script.CreateFunction(new require(script)));
            script.SetObjectInternal("import", script.CreateFunction(new require(script)));
            script.SetObjectInternal("using", script.CreateFunction(new require(script)));
            script.SetObjectInternal("push_search", script.CreateFunction(new push_search(script)));
            script.SetObjectInternal("push_define", script.CreateFunction(new push_define(script)));

            script.SetObjectInternal("load_assembly", script.CreateFunction(new load_assembly(script)));
            script.SetObjectInternal("load_assembly_safe", script.CreateFunction(new load_assembly_safe(script)));
            script.SetObjectInternal("push_assembly", script.CreateFunction(new push_assembly(script)));
            script.SetObjectInternal("import_type", script.CreateFunction(new import_type(script)));
            script.SetObjectInternal("import_extension", script.CreateFunction(new import_extension(script)));
            script.SetObjectInternal("generic_type", script.CreateFunction(new generic_type(script)));
            script.SetObjectInternal("generic_method", script.CreateFunction(new generic_method(script)));
        }
        public static void Load(Script script)
        {
            ScriptTable Table = script.CreateTable();
            Table.SetValue("count", script.CreateFunction(new count()));
            Table.SetValue("insert", script.CreateFunction(new insert()));
            Table.SetValue("add", script.CreateFunction(new add()));
            Table.SetValue("remove", script.CreateFunction(new remove()));
            Table.SetValue("removeat", script.CreateFunction(new removeat()));
            Table.SetValue("resize", script.CreateFunction(new resize()));
            Table.SetValue("clear", script.CreateFunction(new clear()));
            Table.SetValue("contains", script.CreateFunction(new contains()));
			Table.SetValue("sort", script.CreateFunction(new sort()));
            Table.SetValue("indexof", script.CreateFunction(new indexof()));
            Table.SetValue("lastindexof", script.CreateFunction(new lastindexof()));
            Table.SetValue("first", script.CreateFunction(new first()));
            Table.SetValue("last", script.CreateFunction(new last()));
            Table.SetValue("pop", script.CreateFunction(new popfirst()));
            Table.SetValue("safepop", script.CreateFunction(new safepopfirst()));
            Table.SetValue("popfirst", script.CreateFunction(new popfirst()));
            Table.SetValue("safepopfirst", script.CreateFunction(new safepopfirst()));
            Table.SetValue("poplast", script.CreateFunction(new poplast()));
            Table.SetValue("safepoplast", script.CreateFunction(new safepoplast()));
            script.SetObjectInternal("array", Table);
        }