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


C# ILuaState.PushInteger方法代码示例

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


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

示例1: WidgetReadOper

        protected override bool WidgetReadOper(ILuaState lua, string key)
        {
            switch (key)
            {
                case "speed":
                    lua.PushNumber(_speed);
                    return true;
                case "dwMMethod":
                    lua.PushInteger(_dwMMethod);
                    return true;
                case "bMoving":
                    lua.PushBoolean(_bMoving);
                    return true;
                case "fUpdateInterval":
                    lua.PushNumber(_fUpdateInterval);
                    return true;
                case "fAnimSpeed":
                    if (_animator)
                    {
                        lua.PushNumber(_animator.speed);
                    }
                    else
                    {
                        lua.PushNumber(0);
                    }
                    return true;
            }

            return base.WidgetReadOper(lua, key);
        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:30,代码来源:Actor.cs

示例2: 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

示例3: getEffectTarget

 public static int getEffectTarget(ILuaState luaState)
 {
     SkillEffect effect = (SkillEffect)luaState.ToUserData(-1);
     if (effect == null)
     {
         throw new ArgumentException("effect is null!");
     }
     luaState.PushInteger(effect.getTarget());
     return 1;
 }
开发者ID:LostTemple1990,项目名称:TouHouExploding,代码行数:10,代码来源:PropertyLib.cs

示例4: Str_Byte

		private static int Str_Byte( ILuaState lua )
		{
			string s = lua.L_CheckString(1);
			int posi = PosRelative( lua.L_OptInt(2, 1), s.Length );
			int pose = PosRelative( lua.L_OptInt(3, posi), s.Length );
			if( posi < 1 ) posi = 1;
			if( pose > s.Length ) pose = s.Length;
			if( posi > pose ) return 0; // empty interval; return no values
			int n = pose - posi + 1;
			if( posi + n <= pose) // overflow?
				return lua.L_Error( "string slice too long" );
			lua.L_CheckStack(n, "string slice too long");
			for( int i=0; i<n; ++i )
				lua.PushInteger( (byte)s[(int)posi+i-1] );
			return n;
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:16,代码来源:LuaStrLib.cs

示例5: B_CollectGarbage

        public static int B_CollectGarbage( ILuaState lua )
        {
            // not implement gc
            string opt = lua.L_OptString( 1, "collect" );
            switch( opt )
            {
                case "count":
                    lua.PushNumber( 0 );
                    lua.PushNumber( 0 );
                    return 2;

                case "step":
                case "isrunning":
                    lua.PushBoolean( true );
                    return 1;

                default:
                    lua.PushInteger( 0 );
                    return 1;
            }
        }
开发者ID:matthewyang,项目名称:UniLua,代码行数:21,代码来源:LuaBaseLib.cs

示例6: Lua_GetID

 int Lua_GetID(ILuaState lua)
 {
     lua.PushInteger(_dwID);
     return 1;
 }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:5,代码来源:Entity.cs

示例7: StrFindAux

		private static int StrFindAux( ILuaState lua, bool find )
		{
			string s = lua.L_CheckString( 1 );
			string p = lua.L_CheckString( 2 );
			int init = PosRelative( lua.L_OptInt(3, 1), s.Length );
			if( init < 1 ) init = 1;
			else if( init > s.Length + 1 ) // start after string's end?
			{
				lua.PushNil(); // cannot find anything
				return 1;
			}
			// explicit request or no special characters?
			if( find && (lua.ToBoolean(4) || NoSpecials(p)) )
			{
				// do a plain search
				int pos = s.IndexOf( p, init-1 );
				if( pos >= 0 )
				{
					lua.PushInteger( pos+1 );
					lua.PushInteger( pos+p.Length );
					return 2;
				}
			}
			else
			{
				int s1 = init-1;
				int ppos = 0;
				bool anchor = p[ppos] == '^';
				if( anchor )
					ppos++; // skip anchor character

				MatchState ms = new MatchState();
				ms.Lua = lua;
				ms.Src = s;
				ms.SrcInit = s1;
				ms.SrcEnd = s.Length;
				ms.Pattern = p;
				ms.PatternEnd = p.Length;

				do
				{
					ms.Level = 0;
					int res = Match( ms, s1, ppos );
					if( res != -1 )
					{
						if(find)
						{
							lua.PushInteger( s1+1 ); // start
							lua.PushInteger( res );  // end
							return PushCaptures(lua, ms, -1, 0) + 2;
						}
						else return PushCaptures(lua, ms, s1, res);
					}
				} while( s1++ < ms.SrcEnd && !anchor );
			}
			lua.PushNil(); // not found
			return 1;
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:58,代码来源:LuaStrLib.cs

示例8: WidgetReadOper

 protected override bool WidgetReadOper(ILuaState lua, string key)
 {
     switch (key)
     {
         case "type":
             lua.PushInteger((int)type);
             return true;
         case "depth":
             lua.PushInteger((int)_camera.depth);
             return true;
         case "distance":
             lua.PushNumber(m_normalInfo.distance);
             return true;
         case "parent":
             LuaObject pParent = transform.parent.GetComponent<LuaObject>();
             pParent.RefLua();
             pParent.PushThis(lua);
             return true;
         case "ml_target":
             LuaObject mpParent = ml_Target.GetComponent<LuaObject>();
             mpParent.RefLua();
             mpParent.PushThis(lua);
             return true;
         case "target":
             if (m_Target != null)
             {
                 LuaObject tar = m_Target.GetComponent<LuaObject>();
                 if (tar != null)
                     tar.PushThis(lua);
                 return true;
             }
             return false;
         case "LRAngle":
             lua.PushNumber(m_normalInfo.rotationLR);
             return true;
         case "UDAngle":
             lua.PushNumber(m_normalInfo.rotationUD);
             return true;
         case "offsetX":
             lua.PushNumber(m_normalInfo.offSet.x);
             return true;
         case "offsetY":
             lua.PushNumber(m_normalInfo.offSet.y);
             return true;
         case "offsetZ":
             lua.PushNumber(m_normalInfo.offSet.z);
             return true;
         case "offset":
             lua.NewTable();
             lua.PushNumber(m_normalInfo.offSet.x);
             lua.SetField(-2, "x");
             lua.PushNumber(m_normalInfo.offSet.y);
             lua.SetField(-2, "y");
             lua.PushNumber(m_normalInfo.offSet.z);
             lua.SetField(-2, "z");
             return true;
     }
     //return false;
     return base.WidgetReadOper(lua, key);
 }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:60,代码来源:LuaGameCamera.cs

示例9: WidgetReadOper

 protected override bool WidgetReadOper(ILuaState lua, string key)
 {
     switch (key)
     {
         case "type":
             lua.PushInteger(_realInfo.type);
             break;
         case "intensity":
             lua.PushNumber(_realInfo.intensity);
             break;
         default:
             return base.WidgetReadOper(lua, key);
     }
     return true;
 }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:15,代码来源:StoryCameraShakeCtrl.cs

示例10: WidgetReadOper

        protected override bool WidgetReadOper(ILuaState lua, string key)
        {
            switch (key)
            {
                case "name":
                    lua.PushString(gameObject.name);
                    break;
                case "fDir":
                    lua.PushNumber(transform.localEulerAngles.y);
                    break;
                case "position":
                    Vector3ToStack(lua, transform.position);
                    break;
                case "localPosition":
                    Vector3ToStack(lua, transform.localPosition);
                    break;
                case "localRotate":
                    Vector3ToStack(lua, transform.localEulerAngles);
                    break;
                case "localScale":
                    Vector3ToStack(lua, transform.localScale);
                    break;
                case "ambientLight":
                    ColorToStack(lua, RenderSettings.ambientLight);
                    break;
                case "ambientIntensity":
#if UNITY_4_6
                    lua.PushNumber(1.0);
#else
                    lua.PushNumber(RenderSettings.ambientIntensity);
#endif
                    break;
                case "fog":
                    lua.PushBoolean(RenderSettings.fog);
                    break;
                case "fogColor":
                    ColorToStack(lua, RenderSettings.fogColor);
                    break;
                case "fogDensity":
                    lua.PushNumber(RenderSettings.fogDensity);
                    break;
                case "fogEndDistance":
                    lua.PushNumber(RenderSettings.fogEndDistance);
                    break;
                case "fogMode":
                    lua.PushInteger((int)RenderSettings.fogMode);
                    break;
                case "fogStartDistance":
                    lua.PushNumber(RenderSettings.fogStartDistance);
                    break;
                default:
                    return false;
            }
            return true;
        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:55,代码来源:LuaExport.cs

示例11: PairsMeta

        private static int PairsMeta( ILuaState lua, string method, bool isZero
			, CSharpFunctionDelegate iter )
        {
            if( !lua.L_GetMetaField( 1, method ) ) // no metamethod?
            {
                lua.L_CheckType( 1, LuaType.LUA_TTABLE );
                lua.PushCSharpFunction( iter );
                lua.PushValue( 1 );
                if( isZero )
                    lua.PushInteger( 0 );
                else
                    lua.PushNil();
            }
            else
            {
                lua.PushValue( 1 );
                lua.Call( 1, 3 );
            }
            return 3;
        }
开发者ID:matthewyang,项目名称:UniLua,代码行数:20,代码来源:LuaBaseLib.cs

示例12: Str_Gsub

		private static int Str_Gsub( ILuaState lua )
		{
			
			string src = lua.L_CheckString(1);
			int srcl = src.Length;
			string p = lua.L_CheckString(2);
			LuaType tr = lua.Type(3);
			int max_s = lua.L_OptInt(4, srcl + 1);
			int anchor = 0;
			if (p[0] == '^')
			{
                p = p.Substring(1);
                anchor = 1;
			}
			int n = 0;
			MatchState ms = new MatchState();
			StringBuilder b = new StringBuilder(srcl);
			lua.L_ArgCheck(tr == LuaType.LUA_TNUMBER || tr == LuaType.LUA_TSTRING ||
						   tr == LuaType.LUA_TFUNCTION || tr == LuaType.LUA_TTABLE, 3,
							  "string/function/table expected");
			ms.Lua = lua;
			ms.Src = src;
			ms.SrcInit = 0;
			ms.SrcEnd = srcl;
			ms.Pattern = p;
			ms.PatternEnd = p.Length;
			int s = 0;
			while (n < max_s) {
			   ms.Level = 0;
			   int e = Match(ms, s, 0);
			   if (e != -1) {
			       n++;
				   Add_Value(ms, b, s, e);
			   }
			   if ((e != -1) && e > s) /* non empty match? */
			      s = e;  /* skip it */
			   else if (s < ms.SrcEnd)
			   {
			       char c = src[s];
				   ++s;
			       b.Append(c);
			   }
			   else break;
			   if (anchor != 0) break;
		    }
			b.Append(src.Substring(s, ms.SrcEnd - s));
			lua.PushString(b.ToString());
		    lua.PushInteger(n);  /* number of substitutions */
		    return 2;
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:50,代码来源:LuaStrLib.cs

示例13: B_RawLen

 public static int B_RawLen( ILuaState lua )
 {
     LuaType t = lua.Type( 1 );
     lua.L_ArgCheck( t == LuaType.LUA_TTABLE || t == LuaType.LUA_TSTRING,
         1, "table or string expected" );
     lua.PushInteger( lua.RawLen( 1 ) );
     return 1;
 }
开发者ID:matthewyang,项目名称:UniLua,代码行数:8,代码来源:LuaBaseLib.cs

示例14: WidgetReadOper

 protected override bool WidgetReadOper(ILuaState lua, string key)
 {
     switch (key)
     {
         case "dwType":
             lua.PushInteger(_realInfo.type);
             break;
         case "directColor":
             LuaExport.ColorToStack(lua, _realInfo.directColor);
             break;
         case "amount":
             lua.PushNumber(_realInfo.amount);
             break;
         case "bReset":
             lua.PushBoolean(_realInfo.bReset);
             break;
         default:
             return base.WidgetReadOper(lua, key);
     }
     return true;
 }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:21,代码来源:StoryTweenFadeCtrl.cs

示例15: GmatchAux

		private static int GmatchAux( ILuaState lua )
		{
			MatchState ms = new MatchState();
			string src = lua.ToString( lua.UpvalueIndex(1) );
			string pattern = lua.ToString( lua.UpvalueIndex(2) );
			ms.Lua = lua;
			ms.Src = src;
			ms.SrcInit = 0;
			ms.SrcEnd = src.Length;
			ms.Pattern = pattern;
			ms.PatternEnd = pattern.Length;
			for( int s = lua.ToInteger( lua.UpvalueIndex(3) )
			   ; s <= ms.SrcEnd
			   ; s++ )
			{
				ms.Level = 0;
				int e = Match( ms, s, 0 );
				if( e != -1 )
				{
					int newStart = (e == 0) ? e+1: e;
					lua.PushInteger( newStart );
					lua.Replace( lua.UpvalueIndex(3) );
					return PushCaptures(lua, ms, s, e);
				}
			}
			return 0; // not found
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:27,代码来源:LuaStrLib.cs


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