示例#1
0
        static LuaFuncRef CacheCompile(string Script)
        {
            LuaFuncRef ScriptDelegate = null;

            Script = Script.Trim();

            if (Scripts.ContainsKey(Script))
            {
                ScriptDelegate = Scripts[Script];
            }
            else
            {
                ScriptDelegate = Lua.Compile(Script);
                Scripts.Add(Script, ScriptDelegate);
            }

            return(ScriptDelegate);
        }
示例#2
0
        public static void Main(string[] args)
        {
            Lua a = new Lua(
                "i = print\n" +
                "do\n" +
                "print = \"Hello\"\n" +
                "print = print .. \" World!\"\n" +
                "end\n" +
                "i(print)");

            Console.WriteLine("Compiling ... {0}", a.Compile());

            Console.WriteLine(a.ast);

            Console.WriteLine("Running ... ");

            a.vm.debug = true;
            a.Run();


            Console.ReadKey();
            return;
        }