当前位置: 首页>>代码示例>>C#>>正文


C# ILuaState.GetTable方法代码示例

本文整理汇总了C#中ILuaState.GetTable方法的典型用法代码示例。如果您正苦于以下问题:C# ILuaState.GetTable方法的具体用法?C# ILuaState.GetTable怎么用?C# ILuaState.GetTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILuaState的用法示例。


在下文中一共展示了ILuaState.GetTable方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: testLuaCall

 public static int testLuaCall(ILuaState luaState)
 {
     bool arg2 = luaState.ToBoolean(-1);
     luaState.GetField(1, "n");
     int len = luaState.ToInteger(-1);
     luaState.Pop(1);
     int sum = 0;
     for (int i=0;i<len;i++)
     {
         luaState.PushInteger(i + 1);
         luaState.GetTable(1);
         sum += luaState.ToInteger(-1);
         luaState.Pop(1);
     }
     Thread.Sleep(5000);
     luaState.PushInteger(sum);
     Debug.Log(sum);
     return 1;
 }
开发者ID:LostTemple1990,项目名称:TouHouExploding,代码行数:19,代码来源:TestLuaLib.cs

示例2: ImportProperty

 public void ImportProperty(ILuaState lua, int dwIndex)
 {
     _listCtrl.Clear();
     lua.PushValue(dwIndex);
     int len = lua.L_Len(-1);
     for (int i = 1; i <= len; i++)
     {
         lua.PushNumber(i);
         lua.GetTable(-2);
         lua.PushString("event");
         lua.GetTable(-2);
         string eventName = lua.L_CheckString(-1);
         lua.Pop(1);
         StoryBaseCtrl objCtrl = InstanceEventCtrl(eventName);
         if (objCtrl != null)
         {
             objCtrl.ImportProperty(lua, -1);
             objCtrl.ModInfo();
         }
         else
         {
             Debug.LogWarning("InstanceEventCtrl objCtrl is null " + eventName);
         }
         lua.Pop(1);
         Add(objCtrl);
     }
     lua.Pop(1);
 }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:28,代码来源:StoryShotCtrl.cs

示例3: WidgetWriteOper

        protected override bool WidgetWriteOper(ILuaState lua, string key)
        {
            switch (key)
            {
                case "isLoop":
                    _cameraPath.loop = (bool)lua.ToBoolean(3);
                    break;
                case "interpolation":
                    _cameraPath.interpolation = (CameraPath.Interpolation)lua.ToInteger(3);
                    break;
                case "animtarget":
                    LuaObject obj = LuaObject.GetLuaObject(lua, 3);
                    SetAnimTarget(obj.transform);
                    break;
                case "animMode":
                    _cameraAnimator.animationMode = (CameraPathAnimator.animationModes)lua.ToInteger(3);
                    break;
                case "speed":
                    _cameraAnimator.pathSpeed = (float)lua.ToNumber(3);
                    break;
                case "controlpoints":
                    lua.PushValue(3);
                    int count = lua.L_Len(-1);
                    _cameraPath.Clear();
                    for (int i = 1; i <= count; i++)
                    {
                        lua.PushNumber(i);
                        lua.GetTable(-2);

                        lua.PushString("controlpoint");
                        lua.GetTable(-2);
                        Vector3 controlPoint = GetVector3(lua, -1);
                        lua.Pop(1);
                        lua.PushString("forwardControlPoint");
                        lua.GetTable(-2);
                        Vector3 forwardControlPoint = GetVector3(lua, -1);
                        lua.Pop(1);
                        lua.PushString("backwardControlPoint");
                        lua.GetTable(-2);
                        Vector3 backwardControlPoint = GetVector3(lua, -1);
                        lua.Pop(1);

                        lua.Pop(1);
                        _cameraPath.AddPoint(controlPoint);
                        _cameraPath[i-1].forwardControlPoint = forwardControlPoint;
                        _cameraPath[i-1].backwardControlPoint = backwardControlPoint;
                    }
                    lua.Pop(1);
                    break;
                case "speedArr": //lsy add
                    //Debug.Log("-----------SPEED-------WRITE----------");
                    lua.PushValue(3);
                    int count2 = lua.L_Len(-1);
                    _cameraPath.speedList.Clear();
                    for (int i = 1; i <= count2; i++) {
                        lua.PushNumber(i);
                        lua.GetTable(-2);
                        Quaternion pointRotation = GetQuaternion(lua, -1);
                       //------------------------------------------
                        int point = -1, cpointA = -1, cpointB = -1;
                        float curvePercentage = 0f;
                        int speed = 0;

                        //free or fixedToPoint
                        lua.PushString("positionModes");
                        lua.GetTable(-2);
                        CameraPathPoint.PositionModes positionModes = (CameraPathPoint.PositionModes)lua.ToInteger(-1);
                        lua.Pop(1);

                        lua.PushString("percent");
                        lua.GetTable(-2);
                        float percent = (float)lua.ToNumber(-1);
                        lua.Pop(1);

                        lua.PushString("point");
                        lua.GetTable(-2);
                        if (lua.Type(-1) != LuaType.LUA_TNIL)
                            point = lua.ToInteger(-1);
                        lua.Pop(1);

                        lua.PushString("cpointA");
                        lua.GetTable(-2);
                        if (lua.Type(-1) != LuaType.LUA_TNIL)
                            cpointA = lua.ToInteger(-1);
                        lua.Pop(1);

                        lua.PushString("cpointB");
                        lua.GetTable(-2);
                        if (lua.Type(-1) != LuaType.LUA_TNIL)
                            cpointB = lua.ToInteger(-1);
                        lua.Pop(1);

                        lua.PushString("curvePercentage");
                        lua.GetTable(-2);
                        if (lua.Type(-1) != LuaType.LUA_TNIL)
                            curvePercentage = (float)lua.ToNumber(-1);
                        lua.Pop(1);

                        lua.PushString("speed");
                        lua.GetTable(-2);
//.........这里部分代码省略.........
开发者ID:cedar-x,项目名称:unilua_story,代码行数:101,代码来源:LuaPathCamera.cs

示例4: GetKeyframe

        public static Keyframe GetKeyframe(ILuaState lua, int index)
        {
            Keyframe key = new Keyframe();
            lua.PushValue(index);
            lua.PushString("time");
            lua.GetTable(-2);
            key.time = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.PushString("value");
            lua.GetTable(-2);
            key.value = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.PushString("inTangent");
            lua.GetTable(-2);
            key.inTangent = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.PushString("outTangent");
            lua.GetTable(-2);
            key.outTangent = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.Pop(1);
            return key;

        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:28,代码来源:LuaExport.cs

示例5: GetAnimationCurve

        public static AnimationCurve GetAnimationCurve(ILuaState lua, int dwIndex)
        {
            AnimationCurve animCurve = new AnimationCurve();
            lua.PushValue(dwIndex);
            int count = lua.L_Len(-1);

            for (int i = 1; i <= count; i++)
            {
                lua.PushInteger(i);
                lua.GetTable(-2);
                Keyframe key = GetKeyframe(lua, -1);
                animCurve.AddKey(key);
                lua.Pop(1);
            }
            lua.Pop(1);
            return animCurve;
        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:17,代码来源:LuaExport.cs

示例6: GetNormalInfo

        public static normalInfo GetNormalInfo(ILuaState lua, int dwIndex)
        {
            normalInfo nInfo = new normalInfo();
            lua.PushValue(dwIndex);
            lua.PushString("LRAngle");
            lua.GetTable(-2);
            nInfo.rotationLR = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.PushString("UDAngle");
            lua.GetTable(-2);
            nInfo.rotationUD = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.PushString("distance");
            lua.GetTable(-2);
            nInfo.distance = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.PushString("offset");
            lua.GetTable(-2);
            nInfo.offSet = GetVector3(lua, -1);
            lua.Pop(1);

            lua.Pop(1);
            return nInfo;

        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:28,代码来源:LuaExport.cs

示例7: GetColor

        public static Color GetColor(ILuaState lua, int dwIndex)
        {
            Color v = Color.black;
            lua.PushValue(dwIndex);
            lua.PushString("r");
            lua.GetTable(-2);
            v.r = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.PushString("g");
            lua.GetTable(-2);
            v.g = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.PushString("b");
            lua.GetTable(-2);
            v.b = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.PushString("a");
            lua.GetTable(-2);
            v.a = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.Pop(1);
            return v;

        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:28,代码来源:LuaExport.cs

示例8: GetQuaternion

        public static Quaternion GetQuaternion(ILuaState lua, int dwIndex)
        {
            Quaternion v = new Quaternion();
            lua.PushValue(dwIndex);
            lua.PushString("x");
            lua.GetTable(-2);
            v.x = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.PushString("y");
            lua.GetTable(-2);
            v.y = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.PushString("z");
            lua.GetTable(-2);
            v.z = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.PushString("w");
            lua.GetTable(-2);
            v.w = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.Pop(1);
            return v;
        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:27,代码来源:LuaExport.cs

示例9: GetVector2

        /// <summary>
        /// 
        /// </summary>
        public static Vector3 GetVector2(ILuaState lua, int dwIndex)
        {
            Vector2 v = Vector2.zero;
            lua.PushValue(dwIndex);
            lua.PushString("x");
            lua.GetTable(-2);
            v.x = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.PushString("y");
            lua.GetTable(-2);
            v.y = (float)lua.ToNumber(-1);
            lua.Pop(1);

            lua.Pop(1);

            return v;
        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:21,代码来源:LuaExport.cs

示例10: GetPath

		public static Vector3[] GetPath(ILuaState lua , int dwIndex){
			int count =	lua.L_Len (-1);
			Vector3[] path = new Vector3[count];
			for (int i = 1; i<= count; i++) {
				lua.PushNumber (i);
				lua.GetTable (-2);	
				Vector3 v = GetVector3(lua,-1);
				lua.Pop(1);
				path[i-1] = v;

			}
			//lua.Pop (1);
			return path;
		}
开发者ID:cedar-x,项目名称:unilua_story,代码行数:14,代码来源:LuaItween.cs


注:本文中的ILuaState.GetTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。