本文整理汇总了C#中ILuaState.PushNil方法的典型用法代码示例。如果您正苦于以下问题:C# ILuaState.PushNil方法的具体用法?C# ILuaState.PushNil怎么用?C# ILuaState.PushNil使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILuaState
的用法示例。
在下文中一共展示了ILuaState.PushNil方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: B_GetMetaTable
public static int B_GetMetaTable( ILuaState lua )
{
lua.L_CheckAny( 1 );
if( !lua.GetMetaTable( 1 ) )
{
lua.PushNil();
return 1; // no metatable
}
lua.L_GetMetaField( 1, "__metatable" );
return 1;
}
示例2: getEventVO
public static int getEventVO(ILuaState luaState)
{
BattleEventBase evt = (BattleEventBase)luaState.ToUserData(-1);
if ( evt == null )
{
luaState.PushNil();
}
else
{
luaState.PushLightUserData(evt.getEventVO());
}
return 1;
}
示例3: TBL_MaxN
private static int TBL_MaxN( ILuaState lua )
{
double max = 0.0;
lua.L_CheckType( 1, LuaType.LUA_TTABLE );
lua.PushNil(); // first key
while( lua.Next(1) )
{
lua.Pop( 1 ); // remove value
if( lua.Type( -1 ) == LuaType.LUA_TNUMBER ) {
double v = lua.ToNumber( -1 );
if( v > max ) max = v;
}
}
lua.PushNumber( max );
return 1;
}
示例4: FFI_ParseSignature
// return `ReturnType', `FuncName', `ParameterTypes'
private static int FFI_ParseSignature( ILuaState lua )
{
var signature = lua.ToString(1);
var result = FuncSignatureParser.Parse( lua, signature );
if( result.ReturnType != null )
lua.PushString( result.ReturnType );
else
lua.PushNil();
lua.PushString( result.FuncName );
if( result.ParameterTypes != null ) {
lua.NewTable();
for( int i=0; i<result.ParameterTypes.Length; ++i ) {
lua.PushString( result.ParameterTypes[i] );
lua.RawSetI( -2, i+1 );
}
}
else {
lua.PushNil();
}
return 3;
}
示例5: FFI_GetType
private static int FFI_GetType( ILuaState lua )
{
string typename = lua.ToString(1);
var t = GetType(typename);
// UnityEngine.Debug.Log("GET TYPE:" + typename + " => " + t );
if( t != null )
lua.PushLightUserData(t);
else
lua.PushNil();
return 1;
}
示例6: 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;
}
示例7: ImportProperty
public void ImportProperty(ILuaState lua, int index)
{
lua.PushValue(index);
lua.PushNil();
while(lua.Next(-2))
{
int key = lua.L_CheckInteger(-2);
StoryShotCtrl shotctrl = _shots[key-1];
shotctrl.ImportProperty(lua, -1);
lua.Pop(1);
}
lua.Pop(1);
}
示例8: Lua_UseParam
int Lua_UseParam(ILuaState lua)
{
if (lua.Type(2) != LuaType.LUA_TTABLE)
{
Debug.LogWarning("Lua Game Camera UseParam parm table excepted.");
return 0;
}
lua.PushNil();
while (lua.Next(-2))
{
string key = lua.L_CheckString(-2);
switch (key)
{
case "distance":
m_normalInfo.distance = (float)lua.L_CheckNumber(-1);
break;
case "offset":
m_normalInfo.offSet = LuaItween.GetVector3(lua, -1);
break;
case "LRAngle":
m_normalInfo.rotationLR = (float)lua.L_CheckNumber(-1);
break;
case "UDAngle":
m_normalInfo.rotationUD = (float)lua.L_CheckNumber(-1);
break;
default:
break;
}
lua.Pop(1);
}
lua.Pop(1);
return 0;
}
示例9: LoadAux
private static int LoadAux( ILuaState lua, ThreadStatus status, int envidx )
{
if( status == ThreadStatus.LUA_OK )
{
if( envidx != 0 ) // `env' parameter?
{
lua.PushValue(envidx); // push `env' on stack
if( lua.SetUpvalue(-2, 1) == null ) // set `env' as 1st upvalue of loaded function
{
lua.Pop(1); // remove `env' if not used by previous call
}
}
return 1;
}
else // error (message is on top of the stack)
{
lua.PushNil();
lua.Insert(-2); // put before error message
return 2; // return nil plus error message
}
}
示例10: pushEffect
public void pushEffect(ILuaState luaState,ISkillEffect effect)
{
if ( effect == null || effect.getRef() == 0 )
{
luaState.PushNil();
}
else
{
luaState.RawGetI(LuaDef.LUA_REGISTRYINDEX, effect.getRef());
}
}
示例11: B_ToNumber
public static int B_ToNumber( ILuaState lua )
{
LuaType t = lua.Type( 2 );
if( t == LuaType.LUA_TNONE || t == LuaType.LUA_TNIL ) // standard conversion
{
bool isnum;
double n = lua.ToNumberX( 1, out isnum );
if( isnum )
{
lua.PushNumber( n );
return 1;
} // else not a number; must be something
lua.L_CheckAny( 1 );
}
else
{
string s = lua.L_CheckString( 1 );
int numBase = lua.L_CheckInteger( 2 );
bool negative = false;
lua.L_ArgCheck( (2 <= numBase && numBase <= 36), 2,
"base out of range" );
s = s.Trim( ' ', '\f', '\n', '\r', '\t', '\v' );
s = s + '\0'; // guard
int pos = 0;
if(s[pos] == '-') { pos++; negative = true; }
else if(s[pos] == '+') pos++;
if( Char.IsLetterOrDigit( s, pos ) )
{
double n = 0.0;
do
{
int digit;
if( Char.IsDigit( s, pos ) )
digit = Int32.Parse( s[pos].ToString() );
else
digit = Char.ToUpper( s[pos] ) - 'A' + 10;
if( digit >= numBase )
break; // invalid numeral; force a fail
n = n * (double)numBase + (double)digit;
pos++;
} while( Char.IsLetterOrDigit( s, pos ) );
if( pos == s.Length - 1 ) // except guard, no invalid trailing characters?
{
lua.PushNumber( negative ? -n : n );
return 1;
} // else not a number
} // else not a number
}
lua.PushNil(); // not a number
return 1;
}
示例12: getVOProperty
/// <summary>
/// 获取IBattleVO接口中的属性
/// </summary>
/// <param name="luaState"></param>
/// <returns></returns>
public static int getVOProperty(ILuaState luaState)
{
IBattleVO vo = (IBattleVO)luaState.ToUserData(-2);
if (vo == null)
{
luaState.PushNil();
}
else
{
BattleConsts.Property propId = (BattleConsts.Property)luaState.ToInteger(-1);
object prop = vo.getProperty(propId);
if (prop == null)
{
luaState.PushNil();
}
else
{
// todo 暂时使用is来判断
// 以后可能会加入全局hash
if ( prop is int )
{
luaState.PushInteger((int)prop);
}
else if ( prop is bool )
{
luaState.PushBoolean((bool)prop);
}
else if ( prop is string )
{
luaState.PushString((string)prop);
}
else
{
luaState.PushLightUserData(prop);
}
}
}
return 1;
}
示例13: TBL_Remove
private static int TBL_Remove( ILuaState lua )
{
int e = AuxGetN(lua, 1);
int pos = lua.L_OptInt( 2, e );
if( !(1 <= pos && pos <= e) ) // position is outside bounds?
return 0; // nothing to remove
lua.RawGetI(1, pos); /* result = t[pos] */
for( ; pos<e; ++pos )
{
lua.RawGetI( 1, pos+1 );
lua.RawSetI( 1, pos ); // t[pos] = t[pos+1]
}
lua.PushNil();
lua.RawSetI( 1, e ); // t[2] = nil
return 1;
}
示例14: ImportProperty
public virtual void ImportProperty(ILuaState lua, int index)
{
bool bFlag = false;
lua.PushValue(index);
lua.PushNil();
while (lua.Next(-2))
{
string key = lua.L_CheckString(-2);
bFlag = WidgetWriteOper(lua, key);
if (bFlag == false)
Debug.LogWarning(luaName + " can't write key:" + key + " please check....");
lua.Pop(1);
}
lua.Pop(1);
}
示例15: FFI_GetType
private static int FFI_GetType( ILuaState lua )
{
string typename = lua.ToString(1);
var t = GetType(typename);
if( t != null )
lua.PushLightUserData(t);
else
lua.PushNil();
return 1;
}