Exemplo n.º 1
0
        static void Main(string[] args)
        {
            LuaTask.LuaEnv l = new LuaTask.LuaEnv();
            l.ErrorEvent += (e, d) =>
            {
                Console.WriteLine(d);
            };

            l.DoString(@"
sys.timerStart(print,2000,'2 seconds')
sys.timerLoopStart(print,1000,'loop')

sys.taskInit(function()
    while true do 
        print('task1',os.time())
        sys.wait(1000)
    end
end)
sys.taskInit(function()
    while true do 
        print('task2',os.time())
        sys.wait(1000)
    end
end)
");

            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            LuaTask.LuaEnv l = new LuaTask.LuaEnv();
            l.ErrorEvent += (e, d) =>
            {
                Console.WriteLine(d);
            };

            l.DoString(@"
import('System')
t = TimeSpan(10000000)
sys.async('mscorlib','System.Threading.Thread.Sleep',t,
function(r,data)
print('cb function',r,data,os.time())
end)
print(os.time())
");


            Console.ReadLine();
        }