Exemplo n.º 1
0
        static string GetInitChunkAsString(LuaBehaviour lb)
        {
            var bytes = lb.GetInitChunk();

            if (bytes == null || bytes.Length == 0)
            {
                return(string.Empty);
            }
            return(System.Text.Encoding.UTF8.GetString(bytes));
        }
Exemplo n.º 2
0
        void SetInitChunkByString(LuaBehaviour lb, string chunk)
        {
            var prop = serializedObject.FindProperty("_InitChunk");

            if (prop != null)
            {
                if (string.IsNullOrEmpty(chunk))
                {
                    prop.ClearArray();
                    lb.SetInitChunk(null);
                }
                else
                {
                    var bytes = System.Text.Encoding.UTF8.GetBytes(chunk);
                    prop.arraySize = bytes.Length;
                    for (int i = 0; i < bytes.Length; ++i)
                    {
                        prop.GetArrayElementAtIndex(i).intValue = (int)bytes[i];
                    }
                    lb.SetInitChunk(bytes);
                }
                serializedObject.ApplyModifiedProperties();
            }
        }
Exemplo n.º 3
0
 internal void SetLuaBehaviour(LuaBehaviour behaviour)
 {
     luaBehaviour = behaviour;
 }
Exemplo n.º 4
0
 public void Load()
 {
     Debug.Assert(luaVm == null);
     luaVm = new Lua();
     LuaBehaviour.SetLua(luaVm);
 }