Esempio n. 1
0
        public void CanCompileEmptyScriptTwice()
        {
            var scriptApi = new ScriptApi();

            scriptApi.CompileWrappedScript<TestScriptArity4>("");
            scriptApi.CompileWrappedScript<TestScriptArity4>("");
        }
Esempio n. 2
0
        public void ExtractScriptDocumentation()
        {
            var scriptApi = new ScriptApi();

            var documentation = scriptApi.ExtractDocumentationFromTypes(new[] { typeof(HappyEnvironment) });

            Console.WriteLine(JsonConvert.SerializeObject(documentation, Formatting.Indented));
        }
Esempio n. 3
0
        public void CanCompileTypedScript()
        {
            var factory = new ScriptApi();

            var script = factory.CompileWrappedScript<TestScript>("throw new Exception()");

            Assert.Throws<Exception>(script.Run);
        }
Esempio n. 4
0
        public void Wrapped()
        {
            var scriptApi = new ScriptApi();
            var wrappedScript = scriptApi.CompileWrappedScript<HappyScript>("Mood(\"Happy!\")");

            string result = wrappedScript.Run();

            result.ShouldEqual("Happy!");
        }
Esempio n. 5
0
        public void HelloWorld()
        {
            var scriptApi = new ScriptApi();
            var script = scriptApi.CompileScript<HelloWorldEnvironment>("DoIt()");

            var environment = new HelloWorldEnvironment();
            script.Run(environment);

            environment.Result.ShouldEqual("Hello World!");
        }
Esempio n. 6
0
        public void VerifyScripts()
        {
            var scriptApi = new ScriptApi();

            scriptApi.VerifyTypes(new [] { typeof(HappyEnvironment) });
        }
Esempio n. 7
0
 public static void PushNull(ScriptState luaState)
 {
     ScriptApi.PushNull(luaState);
 }
Esempio n. 8
0
 public static EventMasks GetHookMask(ScriptState luaState)
 {
     return((EventMasks)ScriptApi.GetHookMask(luaState));
 }
Esempio n. 9
0
 public static void NewUserData(ScriptState luaState, int value)
 {
     ScriptApi.NewUserData(luaState, value);
 }
Esempio n. 10
0
 public static void SetMetatable(ScriptState luaState, int index)
 {
     ScriptApi.SetMetatable(luaState, index);
 }
Esempio n. 11
0
 public static int GetHookCount(ScriptState luaState)
 {
     return(ScriptApi.GetHookCount(luaState));
 }
Esempio n. 12
0
 public static int ToInt(ScriptState luaState, int index)
 {
     return(ScriptApi.ToInt(luaState, ConvertParmenterIndex(index)));
 }
Esempio n. 13
0
 public static void SetGlobalTable(ScriptState luaState)
 {
     ScriptApi.SetGlobalTable(luaState);
 }
Esempio n. 14
0
 public static void PushInt(ScriptState luaState, int i)
 {
     ScriptApi.PushInt(luaState, i);
 }
Esempio n. 15
0
 public static double ToNumber(ScriptState luaState, int index)
 {
     return(ScriptApi.ToNumber(luaState, ConvertParmenterIndex(index)));
 }
Esempio n. 16
0
 public static void PushString(ScriptState luaState, string str)
 {
     ScriptApi.PushString(luaState, str);
 }
Esempio n. 17
0
 public static void PushBool(ScriptState luaState, bool b)
 {
     ScriptApi.PushBool(luaState, b ? 1 : 0);
 }
Esempio n. 18
0
 public static void PushNumber(ScriptState luaState, double d)
 {
     ScriptApi.PushNumber(luaState, d);
 }
Esempio n. 19
0
 public static void CreateTable(ScriptState luaState)
 {
     ScriptApi.CreateTable(luaState);
 }
Esempio n. 20
0
        public static string ToString(ScriptState luaState, int index)
        {
            CharPtr ptrString = ScriptApi.ToString(luaState, ConvertParmenterIndex(index));

            return(ptrString.ToString());
        }
Esempio n. 21
0
 public static void GetTable(ScriptState luaState, int index)
 {
     ScriptApi.GetTable(luaState, index);
 }
Esempio n. 22
0
        public static bool ToBool(ScriptState luaState, int index)
        {
            var result = ScriptApi.ToBool(luaState, ConvertParmenterIndex(index));

            return(result == 1);
        }
Esempio n. 23
0
 public static void GetMetatable(ScriptState luaState, string name)
 {
     ScriptApi.GetMetatable(luaState, name);
 }
Esempio n. 24
0
        public static void Atpanic(ScriptState luaState, ScriptFunctionHandler fn)
        {
            var ptr = ConvertDelegateToIntPtr(fn);

            ScriptApi.Atpanic(luaState, ptr);
        }
Esempio n. 25
0
 public static int SetHook(ScriptState luaState, EventMasks mask, int count)
 {
     return(ScriptApi.SetHook(luaState, (int)mask, count));
 }
Esempio n. 26
0
        public static void RegisterMethod(ScriptState luaState, string methodName, ScriptFunctionHandler fn)
        {
            var ptr = ConvertDelegateToIntPtr(fn);

            ScriptApi.RegisterMethod(luaState, methodName, ptr);
        }
Esempio n. 27
0
        public static string SetLocal(ScriptState luaState, LuaDebug ar, int n)
        {
            CharPtr local = ScriptApi.SetLocal(luaState, ar, n);

            return(local.ToString());
        }
Esempio n. 28
0
 public ScriptGalleryDetailViewModel(ScriptApi api, ScriptGalleryModel gallery)
 {
     Api     = api;
     Gallery = gallery;
     Refresh();
 }
Esempio n. 29
0
 public static void GlobalRawGet(ScriptState luaState, int index)
 {
     ScriptApi.GlobalRawGet(luaState, index);
 }
 public ScriptGalleryReadingImage(string link, ScriptApi api, int index)
 {
     _link = link;
     _api  = api;
     Index = index;
 }
 protected override void Arrange()
 {
     _scriptApi = new ScriptApi();
 }
Esempio n. 32
0
 public static void SetTableValue(ScriptState luaState, int index, Action <ScriptState> action)
 {
     ScriptApi.SetTableValue(luaState, index, ConvertDelegateToIntPtr(CreateNativeFunction(action)));
 }
Esempio n. 33
0
 public static int GetRef(ScriptState luaState, int index)
 {
     return(ScriptApi.GetRef(luaState, index));
 }
Esempio n. 34
0
 public void BeforeEachTest()
 {
     _scriptApi = new ScriptApi();
 }
Esempio n. 35
0
 public static int GetGlobalRef(ScriptState luaState, string globalName, ScriptTypes luaType)
 {
     return(ScriptApi.GetGlobalRef(luaState, globalName, (int)luaType));
 }
 public ScriptGalleryReadingViewModel(ScriptApi api, ScriptGalleryDetailModel detail) : base(
         detail.Title)
 {
     Api    = api;
     Detail = detail;
 }