コード例 #1
0
    public void Start()
    {
        //Init LuaBinding class that demonstrates communication
        LuaBinding binding = new LuaBinding();

        //Init instance of Lua virtual machine (Note: Can only init ONCE)
        luaVirtualMachine = new Lua();
        //Tell Lua about the LuaBinding object to allow Lua to call C# functions
        luaVirtualMachine["luabinding"] = binding;

        //test luabinding test
        LuaBindingTest bindingTest = LuaBindingTest.SharedInstance();
        bindingTest.name = "name1";
        luaVirtualMachine["LuaBindingTest"] = bindingTest;
        //luaVirtualMachine[""] = ;

        //Debug.LogError("LuaManager: " + Application.persistentDataPath);

        //Run the code contained within the file
        #if UNITY_ANDROID
        luaVirtualMachine.DoFile("/sdcard/Download/"+LuaFileToLoad);
        #else
        luaVirtualMachine.DoFile(Application.streamingAssetsPath+"/"+LuaFileToLoad);
        #endif
        //Trigger binding in c# to call the bound Lua function

        binding.MessageToLua();
        TestStaticFunction();
    }
コード例 #2
0
    public void Start()
    {
        //Init LuaBinding class that demonstrates communication
        LuaBinding binding = new LuaBinding();

        //Init instance of Lua virtual machine (Note: Can only init ONCE)
        luaVirtualMachine = new Lua();
        //Tell Lua about the LuaBinding object to allow Lua to call C# functions
        luaVirtualMachine["luabinding"] = binding;

        //test luabinding test
        LuaBindingTest bindingTest = LuaBindingTest.SharedInstance();

        bindingTest.name = "name1";
        luaVirtualMachine["LuaBindingTest"] = bindingTest;
        //luaVirtualMachine[""] = ;

        //Debug.LogError("LuaManager: " + Application.persistentDataPath);

        //Run the code contained within the file
#if UNITY_ANDROID
        luaVirtualMachine.DoFile("/sdcard/Download/" + LuaFileToLoad);
#else
        luaVirtualMachine.DoFile(Application.streamingAssetsPath + "/" + LuaFileToLoad);
#endif
        //Trigger binding in c# to call the bound Lua function

        binding.MessageToLua();
        TestStaticFunction();
    }
コード例 #3
0
    public void Start()
    {
        //Init LuaBinding class that demonstrates communication
        LuaBinding binding = new LuaBinding();

        //Init instance of Lua virtual machine (Note: Can only init ONCE)
        luaVirtualMachine = new Lua();
        //Tell Lua about the LuaBinding object to allow Lua to call C# functions
        luaVirtualMachine["luabinding"] = binding;
        //Run the code contained within the file
        luaVirtualMachine.DoFile(Application.streamingAssetsPath + "/" + LuaFileToLoad);
        //Trigger binding in c# to call the bound Lua function
        binding.MessageToLua();
    }
コード例 #4
0
    public void Start()
    {
        //Init LuaBinding class that demonstrates communication
        LuaBinding binding = new LuaBinding();

        //Init instance of Lua virtual machine (Note: Can only init ONCE)
        luaVirtualMachine = new Lua();
        //Tell Lua about the LuaBinding object to allow Lua to call C# functions
        luaVirtualMachine["luabinding"] = binding;
        //Run the code contained within the file
        luaVirtualMachine.DoFile(Application.streamingAssetsPath+"/"+LuaFileToLoad);
        //Trigger binding in c# to call the bound Lua function
        binding.MessageToLua();
    }
コード例 #5
0
        void InitLua()
        {
            //Init LuaBinding class that demonstrates communication
            LuaBinding   binding = new LuaBinding();
            DebugBinding debug   = new DebugBinding();

            //Init instance of Lua virtual machine (Note: Can only init ONCE)
            luaVM = new Lua();
            luaVM.DoFile(Application.streamingAssetsPath + Path.DirectorySeparatorChar + "vm.lua");
            //Tell Lua about the LuaBinding object to allow Lua to call C# functions
            luaVM["luabinding"] = binding;
            luaVM["debug"]      = debug;

            //Run the code contained within the file
            luaVM.DoFile(Application.streamingAssetsPath + "/" + "luademo.lua");

            //Trigger binding in c# to call the bound Lua function
            binding.MessageToLua();
        }