Created
February 28, 2015 15:29
-
-
Save baba-s/dd9efaeef19bc1f32c57 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using LuaInterface; | |
| using System.Reflection; | |
| using UnityEngine; | |
| public class LuaTest : MonoBehaviour | |
| { | |
| private Lua mLua; | |
| private void Start() | |
| { | |
| var filename = Application.dataPath + "/luaTest.lua"; | |
| var type = GetType(); | |
| mLua = new Lua(); | |
| mLua.RegisterFunction( "publicLog", this, type.GetMethod( "PublicLog" ) ); | |
| mLua.RegisterFunction( "privateLog", this, type.GetMethod( "PrivateLog", BindingFlags.NonPublic | BindingFlags.Instance ) ); | |
| mLua.RegisterFunction( "publicStaticLog", this, type.GetMethod( "PublicStaticLog", BindingFlags.Public | BindingFlags.Static ) ); | |
| mLua.RegisterFunction( "privateStaticLog", this, type.GetMethod( "PrivateStaticLog", BindingFlags.NonPublic | BindingFlags.Static ) ); | |
| mLua.DoFile( filename ); | |
| } | |
| public void PublicLog() | |
| { | |
| Debug.Log( "PublicLog" ); | |
| } | |
| private void PrivateLog() | |
| { | |
| Debug.Log( "PrivateLog" ); | |
| } | |
| public static void PublicStaticLog() | |
| { | |
| Debug.Log( "PublicStaticLog" ); | |
| } | |
| private static void PrivateStaticLog() | |
| { | |
| Debug.Log( "PrivateStaticLog" ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment