├── Assets ├── scene.unity.meta ├── Plugins │ ├── KopiLua.dll.mdb.meta │ ├── KopiLua.pdb.meta │ ├── KopiLua.dll │ ├── KopiLuaDll.dll │ ├── KopiLua.dll.mdb │ ├── COPYRIGHT.meta │ ├── KopiLuaInterface.dll │ ├── KopiLua.dll.meta │ ├── KopiLuaDll.dll.meta │ ├── KopiLuaInterface.dll.meta │ └── COPYRIGHT ├── scene.unity ├── Plugins.meta ├── Scripts.meta ├── StreamingAssets.meta ├── StreamingAssets │ ├── luademo.lua.meta │ └── luademo.lua └── Scripts │ ├── LuaBinding.cs.meta │ ├── LuaManager.cs.meta │ ├── LuaBinding.cs │ └── LuaManager.cs ├── .gitignore ├── ProjectSettings ├── AudioManager.asset ├── InputManager.asset ├── TagManager.asset ├── TimeManager.asset ├── EditorSettings.asset ├── NavMeshLayers.asset ├── NetworkManager.asset ├── DynamicsManager.asset ├── ProjectSettings.asset ├── QualitySettings.asset └── EditorBuildSettings.asset └── README.md /Assets/scene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c0de4aeaa68241b4fbbbf1f2474ceef3 3 | -------------------------------------------------------------------------------- /Assets/Plugins/KopiLua.dll.mdb.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 296b983e1ae1e14458fbb186a22c5d50 3 | -------------------------------------------------------------------------------- /Assets/Plugins/KopiLua.pdb.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9df8eed7baced5f46bfb8d361946212d 3 | -------------------------------------------------------------------------------- /Assets/scene.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DGoodayle/UnityLuaIntegration/HEAD/Assets/scene.unity -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Library 2 | Temp 3 | *.csproj 4 | *.pidb 5 | *.unityproj 6 | *.sln 7 | *.userprefs 8 | *.booproj -------------------------------------------------------------------------------- /Assets/Plugins/KopiLua.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DGoodayle/UnityLuaIntegration/HEAD/Assets/Plugins/KopiLua.dll -------------------------------------------------------------------------------- /Assets/Plugins/KopiLuaDll.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DGoodayle/UnityLuaIntegration/HEAD/Assets/Plugins/KopiLuaDll.dll -------------------------------------------------------------------------------- /Assets/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe5bbe2d41b8cb744a70dcbc9172d186 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Plugins/KopiLua.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DGoodayle/UnityLuaIntegration/HEAD/Assets/Plugins/KopiLua.dll.mdb -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fce5fa7285c2f264cab2f9fe059f9e73 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/StreamingAssets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b36a085a00989fa409c46488c8106ba9 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DGoodayle/UnityLuaIntegration/HEAD/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DGoodayle/UnityLuaIntegration/HEAD/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DGoodayle/UnityLuaIntegration/HEAD/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DGoodayle/UnityLuaIntegration/HEAD/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /Assets/Plugins/COPYRIGHT.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b46729851b9d781449146e6646ed8496 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Plugins/KopiLuaInterface.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DGoodayle/UnityLuaIntegration/HEAD/Assets/Plugins/KopiLuaInterface.dll -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DGoodayle/UnityLuaIntegration/HEAD/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshLayers.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DGoodayle/UnityLuaIntegration/HEAD/ProjectSettings/NavMeshLayers.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DGoodayle/UnityLuaIntegration/HEAD/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DGoodayle/UnityLuaIntegration/HEAD/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DGoodayle/UnityLuaIntegration/HEAD/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DGoodayle/UnityLuaIntegration/HEAD/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /Assets/StreamingAssets/luademo.lua.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d9de1b71f2c0cbc468280102abba6a99 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DGoodayle/UnityLuaIntegration/HEAD/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | UnityLuaIntergration 2 | ==================== 3 | 4 | Using KopiLua and KopiLuaInterface (Copyright to respective owners) within Unity 5 | -------------------------------------------------------------------------------- /Assets/Plugins/KopiLua.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a215f27bcc3e9f14a97f7a1c80ae2313 3 | MonoAssemblyImporter: 4 | serializedVersion: 1 5 | iconMap: {} 6 | executionOrder: {} 7 | -------------------------------------------------------------------------------- /Assets/Plugins/KopiLuaDll.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1af5eb64809f3c34e8221f5837265c60 3 | MonoAssemblyImporter: 4 | serializedVersion: 1 5 | iconMap: {} 6 | executionOrder: {} 7 | userData: 8 | -------------------------------------------------------------------------------- /Assets/Plugins/KopiLuaInterface.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7d3b15b64b394b449b400369f1b7c1d6 3 | MonoAssemblyImporter: 4 | serializedVersion: 1 5 | iconMap: {} 6 | executionOrder: {} 7 | userData: 8 | -------------------------------------------------------------------------------- /Assets/Scripts/LuaBinding.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 703bb0d7f477c8e40a885f69635029db 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/LuaManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af4b9af51bb44da418bd744114896a88 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/luademo.lua: -------------------------------------------------------------------------------- 1 | function WriteFromLua(text) -- Simple function to call the function inside LuaBinding.cs to out a message 2 | luabinding:MessageFromLua(text) 3 | end 4 | 5 | luabinding:BindMessageFunction(WriteFromLua) -- Tell LuaBinding.cs to bind the WriteFromLua function to its LuaFunction variable -------------------------------------------------------------------------------- /Assets/Scripts/LuaBinding.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using LuaInterface; //Reference the LuaInterface DLL 4 | 5 | public class LuaBinding { 6 | //Reference to bound Lua function set within Lua 7 | public LuaFunction boundMessageFunction; 8 | public void BindMessageFunction(LuaFunction func){ 9 | //Binding 10 | boundMessageFunction = func; 11 | } 12 | public void MessageFromLua(string message){ 13 | //Output message into the debug log 14 | Debug.Log(message); 15 | } 16 | public void MessageToLua(){ 17 | //Call the bound function with a string as its first param 18 | boundMessageFunction.Call("Hello"); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Assets/Scripts/LuaManager.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using LuaInterface; 4 | 5 | public class LuaManager : MonoBehaviour { 6 | //Reference to the Lua virtual machine 7 | private Lua luaVirtualMachine; 8 | //Filename of the Lua file to load in the Streaming Assets folder 9 | public string LuaFileToLoad = ""; 10 | public void Start(){ 11 | //Init LuaBinding class that demonstrates communication 12 | LuaBinding binding = new LuaBinding(); 13 | 14 | //Init instance of Lua virtual machine (Note: Can only init ONCE) 15 | luaVirtualMachine = new Lua(); 16 | //Tell Lua about the LuaBinding object to allow Lua to call C# functions 17 | luaVirtualMachine["luabinding"] = binding; 18 | //Run the code contained within the file 19 | luaVirtualMachine.DoFile(Application.streamingAssetsPath+"/"+LuaFileToLoad); 20 | //Trigger binding in c# to call the bound Lua function 21 | binding.MessageToLua(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Assets/Plugins/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Kopi Lua License 2 | ---------------- 3 | 4 | Kopi Lua is licensed under the terms of the MIT license. Both the MIT 5 | license and the original Lua copyright notice are reproduced below. 6 | 7 | Please see http://www.ppl-pilot.com/KopiLua for details. 8 | 9 | =============================================================================== 10 | 11 | Lua License 12 | ----------- 13 | 14 | Lua is licensed under the terms of the MIT license reproduced below. 15 | This means that Lua is free software and can be used for both academic 16 | and commercial purposes at absolutely no cost. 17 | 18 | For details and rationale, see http://www.lua.org/license.html . 19 | 20 | =============================================================================== 21 | 22 | Copyright (C) 1994-2008 Lua.org, PUC-Rio. 23 | 24 | Permission is hereby granted, free of charge, to any person obtaining a copy 25 | of this software and associated documentation files (the "Software"), to deal 26 | in the Software without restriction, including without limitation the rights 27 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 28 | copies of the Software, and to permit persons to whom the Software is 29 | furnished to do so, subject to the following conditions: 30 | 31 | The above copyright notice and this permission notice shall be included in 32 | all copies or substantial portions of the Software. 33 | 34 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 35 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 36 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 37 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 38 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 39 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 40 | THE SOFTWARE. 41 | 42 | =============================================================================== 43 | 44 | LuaInterface License 45 | -------------------- 46 | 47 | LuaInterface is licensed under the terms of the MIT license reproduced below. 48 | This mean that LuaInterface is free software and can be used for both academic and 49 | commercial purposes at absolutely no cost. 50 | 51 | =============================================================================== 52 | 53 | Copyright (C) 2003-2005 Fabio Mascarenhas de Queiroz. 54 | 55 | Permission is hereby granted, free of charge, to any person obtaining a copy 56 | of this software and associated documentation files (the "Software"), to deal 57 | in the Software without restriction, including without limitation the rights 58 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 59 | copies of the Software, and to permit persons to whom the Software is 60 | furnished to do so, subject to the following conditions: 61 | 62 | The above copyright notice and this permission notice shall be included in 63 | all copies or substantial portions of the Software. 64 | 65 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 66 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 67 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 68 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 69 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 70 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 71 | THE SOFTWARE. 72 | 73 | =============================================================================== 74 | 75 | (end of COPYRIGHT) 76 | 77 | (end of COPYRIGHT) --------------------------------------------------------------------------------