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


C# ILuaState.IsTable方法代码示例

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


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

示例1: Awake

	void Awake() {
		Debug.Log("LuaScriptController Awake");

		if( Lua == null )
		{
			Lua = LuaAPI.NewState();
			Lua.L_OpenLibs();

			var status = Lua.L_DoFile( LuaScriptFile );
			if( status != ThreadStatus.LUA_OK )
			{
				throw new Exception( Lua.ToString(-1) );
			}

			if( ! Lua.IsTable(-1) )
			{
				throw new Exception(
					"framework main's return value is not a table" );
			}

			AwakeRef 		= StoreMethod( "awake" );
			StartRef 		= StoreMethod( "start" );
			UpdateRef 		= StoreMethod( "update" );
			LateUpdateRef 	= StoreMethod( "late_update" );
			FixedUpdateRef 	= StoreMethod( "fixed_update" );

			Lua.Pop(1);
			Debug.Log("Lua Init Done");
		}

		CallMethod( AwakeRef );
	}
开发者ID:huxia,项目名称:UniLua,代码行数:32,代码来源:LuaScriptController.cs

示例2: applyTranslate

 public static int applyTranslate(ILuaState luaState)
 {
     if (luaState.IsTable(-1))
     {
         TranslateResult transRes = new TranslateResult();
         // 位移目标
         luaState.GetField(-1, "target");
         transRes.target = (Unit)luaState.ToUserData(-1);
         luaState.Pop(1);
         // 行偏移量
         luaState.GetField(-1, "offsetRow");
         transRes.offsetRow = luaState.ToInteger(-1);
         luaState.Pop(1);
         // 列偏移量
         luaState.GetField(-1, "offsetCol");
         transRes.offsetCol = luaState.ToInteger(-1);
         luaState.Pop(1);
         //// 位移原因
         //luaState.GetField(-1, "translateReason");
         //transRes. = luaState.ToInteger(-1);
         //luaState.Pop(1);
         ProcessManager.getInstance().addResult(transRes);
     }
     return 0;
 }
开发者ID:LostTemple1990,项目名称:TouHouExploding,代码行数:25,代码来源:EffectLib.cs

示例3: applyDamage

 public static int applyDamage(ILuaState luaState)
 {
     if (luaState.IsTable(-1))
     {
         DamageResult dmgRes = new DamageResult();
         // 攻击者
         luaState.GetField(-1, "attacker");
         dmgRes.attacker = (Unit)luaState.ToUserData(-1);
         luaState.Pop(1);
         // 受害者
         luaState.GetField(-1, "victim");
         dmgRes.victim = (Unit)luaState.ToUserData(-1);
         luaState.Pop(1);
         // 伤害
         luaState.GetField(-1, "physicalDamage");
         dmgRes.physicalDamage = luaState.ToInteger(-1);
         luaState.Pop(1);
         luaState.GetField(-1, "spellDamage");
         dmgRes.spellDamage = luaState.ToInteger(-1);
         luaState.Pop(1);
         luaState.GetField(-1, "hpRemoval");
         dmgRes.hpRemoval = luaState.ToInteger(-1);
         luaState.Pop(1);
         // 伤害原因
         luaState.GetField(-1, "damageReason");
         dmgRes.damageReason = (BattleConsts.DamageReason)luaState.ToInteger(-1);
         luaState.Pop(1);
         ProcessManager.getInstance().addResult(dmgRes);
     }
     return 0;
 }
开发者ID:LostTemple1990,项目名称:TouHouExploding,代码行数:31,代码来源:EffectLib.cs

示例4: initSkill

 public void initSkill(ILuaState luaState)
 {
     if ( !luaState.IsTable(-1) )
     {
         Debug.Log(this._skillId + ".lua does  not return a table!");
     }
     this._cost = storeMethod(luaState,"cost");
     luaState.Pop(1);
     // 主动效果
     // 被动效果
 }
开发者ID:LostTemple1990,项目名称:TouHouExploding,代码行数:11,代码来源:SkillDataDriven.cs

示例5: Awake

	void Awake() {
		Debug.Log("LuaScriptController Awake");

		if( Lua == null )
		{
			Lua = LuaAPI.NewState();
			Lua.L_OpenLibs();

			var status = Lua.L_DoFile( LuaScriptFile );
			if( status != ThreadStatus.LUA_OK )
			{
				throw new Exception( Lua.ToString(-1) );
			}

			if( ! Lua.IsTable(-1) )
			{
				throw new Exception(
					"framework main's return value is not a table" );
			}

			AwakeRef 		= StoreMethod( "awake" );
			StartRef 		= StoreMethod( "start" );
			UpdateRef 		= StoreMethod( "update" );
			LateUpdateRef 	= StoreMethod( "late_update" );
			FixedUpdateRef 	= StoreMethod( "fixed_update" );

			Lua.Pop(1);
			Debug.Log("Lua Init Done");
		}
        Lua.GetGlobal("xxsmain");
        if (Lua.PCall(0, 0, 0) != ThreadStatus.LUA_OK)
        {
            Debug.LogWarning("Call global function xxsmain failed:" + Lua.ToString(-1));
            Lua.Pop(1);
        }
        Debug.Log("dofile main...........");
		CallMethod( AwakeRef );
	}
开发者ID:cedar-x,项目名称:unilua_story,代码行数:38,代码来源:LuaScriptController.cs

示例6: FindLoader

		private static void FindLoader( ILuaState lua, string name )
		{
			// will be at index 3
			lua.GetField( lua.UpvalueIndex(1), "searchers" );
			if( ! lua.IsTable(3) )
				lua.L_Error("'package.searchers' must be a table");

			var sb = new StringBuilder();
			// iterator over available searchers to find a loader
			for( int i=1; ; ++i )
			{
				lua.RawGetI( 3, i ); // get a searcher
				if( lua.IsNil( -1 ) ) // no more searchers?
				{
					lua.Pop( 1 ); // remove nil
					lua.PushString( sb.ToString() );
					lua.L_Error( "module '{0}' not found:{1}",
						name, lua.ToString(-1));
					return;
				}

				lua.PushString( name );
				lua.Call( 1, 2 ); // call it
				if( lua.IsFunction(-2) ) // did it find a loader
					return; // module loader found
				else if( lua.IsString(-2) ) // searcher returned error message?
				{
					lua.Pop( 1 ); // return extra return
					sb.Append( lua.ToString(-1) );
				}
				else
					lua.Pop( 2 ); // remove both returns
			}
		}
开发者ID:bharath1097,项目名称:UniLua,代码行数:34,代码来源:LuaPkgLib.cs


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