本文整理汇总了C#中ILuaState.L_Len方法的典型用法代码示例。如果您正苦于以下问题:C# ILuaState.L_Len方法的具体用法?C# ILuaState.L_Len怎么用?C# ILuaState.L_Len使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILuaState
的用法示例。
在下文中一共展示了ILuaState.L_Len方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TBL_Concat
private static int TBL_Concat( ILuaState lua )
{
string sep = lua.L_OptString( 2, "" );
lua.L_CheckType( 1, LuaType.LUA_TTABLE );
int i = lua.L_OptInt( 3, 1 );
int last = lua.L_Opt( lua.L_CheckInteger, 4, lua.L_Len(1) );
StringBuilder sb = new StringBuilder();
for( ; i<last; ++i )
{
lua.RawGetI( 1, i );
if( !lua.IsString(-1) )
lua.L_Error(
"invalid value ({0}) at index {1} in table for 'concat'",
lua.L_TypeName(-1), i );
sb.Append( lua.ToString(-1) );
sb.Append( sep );
lua.Pop( 1 );
}
if( i == last ) // add last value (if interval was not empty)
{
lua.RawGetI( 1, i );
if( !lua.IsString(-1) )
lua.L_Error(
"invalid value ({0}) at index {1} in table for 'concat'",
lua.L_TypeName(-1), i );
sb.Append( lua.ToString(-1) );
lua.Pop( 1 );
}
lua.PushString( sb.ToString() );
return 1;
}
示例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);
}
示例3: AuxGetN
private static int AuxGetN( ILuaState lua, int n )
{
lua.L_CheckType( n, LuaType.LUA_TTABLE );
return lua.L_Len( n );
}
示例4: TBL_Unpack
private static int TBL_Unpack( ILuaState lua )
{
lua.L_CheckType( 1, LuaType.LUA_TTABLE );
int i = lua.L_OptInt( 2, 1 );
int e = lua.L_OptInt( 3, lua.L_Len(1) );
if( i > e ) return 0; // empty range
int n = e - i + 1; // number of elements
if( n <= 0 || !lua.CheckStack(n) ) // n <= 0 means arith. overflow
return lua.L_Error( "too many results to unpack" );
lua.RawGetI( 1, i ); // push arg[i] (avoiding overflow problems
while( i++ < e ) // push arg[i + 1...e]
lua.RawGetI( 1, i );
return n;
}
示例5: 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);
//.........这里部分代码省略.........
示例6: 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;
}
示例7: 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;
}