Ejemplo n.º 1
0
    /// <summary>
    /// 初始化Lua
    /// </summary>
    private void initLuaWorker()
    {
        string luaText = "Script.Main.Main";

        worker = new LuaWorker(luaText);
        worker.DoFile();
    }
Ejemplo n.º 2
0
 static public int set_DoInit(IntPtr l)
 {
     try {
         LuaWorker self = (LuaWorker)checkSelf(l);
         System.Action <SLua.LuaTable> v;
         int op = LuaDelegation.checkDelegate(l, 2, out v);
         if (op == 0)
         {
             self.DoInit = v;
         }
         else if (op == 1)
         {
             self.DoInit += v;
         }
         else if (op == 2)
         {
             self.DoInit -= v;
         }
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 3
0
 static public int GetFieldTable_s(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (matchType(l, argc, 1, typeof(SLua.LuaTable), typeof(int)))
         {
             SLua.LuaTable a1;
             checkType(l, 1, out a1);
             System.Int32 a2;
             checkType(l, 2, out a2);
             var ret = LuaWorker.GetFieldTable(a1, a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 1, typeof(SLua.LuaTable), typeof(string)))
         {
             SLua.LuaTable a1;
             checkType(l, 1, out a1);
             System.String a2;
             checkType(l, 2, out a2);
             var ret = LuaWorker.GetFieldTable(a1, a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 4
0
 static public int get_LuaClassName(IntPtr l)
 {
     try {
         LuaWorker self = (LuaWorker)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.LuaClassName);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 5
0
 static public int get_isLuaReady(IntPtr l)
 {
     try {
         LuaWorker self = (LuaWorker)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.isLuaReady);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 6
0
 static public int Dispose(IntPtr l)
 {
     try {
         LuaWorker self = (LuaWorker)checkSelf(l);
         self.Dispose();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 7
0
 static public int GetChunk(IntPtr l)
 {
     try {
         LuaWorker self = (LuaWorker)checkSelf(l);
         var       ret  = self.GetChunk();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 8
0
 protected override void Awake()
 {
     if (_worker == null)
     {
         _worker = new LuaWorker(_LuaFile);
     }
     else
     {
         _worker.LuaFile = _LuaFile;
     }
     _worker.DoInit = setBehaviour;
     _worker.DoFile(null);
 }
Ejemplo n.º 9
0
 static public int DoFile(IntPtr l)
 {
     try {
         LuaWorker     self = (LuaWorker)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         self.DoFile(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 10
0
 static public int set_LuaFile(IntPtr l)
 {
     try {
         LuaWorker self = (LuaWorker)checkSelf(l);
         string    v;
         checkType(l, 2, out v);
         self.LuaFile = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 11
0
 static public int FormatException_s(IntPtr l)
 {
     try {
         System.Exception a1;
         checkType(l, 1, out a1);
         var ret = LuaWorker.FormatException(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 12
0
 static public int constructor(IntPtr l)
 {
     try {
         LuaWorker     o;
         System.String a1;
         checkType(l, 2, out a1);
         o = new LuaWorker(a1);
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 13
0
 static public int CallLuaStaticMethod(IntPtr l)
 {
     try {
         LuaWorker     self = (LuaWorker)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         System.Object[] a2;
         checkParams(l, 3, out a2);
         var ret = self.CallLuaStaticMethod(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 14
0
 static public int SetEnv(IntPtr l)
 {
     try {
         LuaWorker     self = (LuaWorker)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         System.Object a2;
         checkType(l, 3, out a2);
         System.Boolean a3;
         checkType(l, 4, out a3);
         self.SetEnv(a1, a2, a3);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }