本文整理汇总了C#中ILuaState.L_CheckString方法的典型用法代码示例。如果您正苦于以下问题:C# ILuaState.L_CheckString方法的具体用法?C# ILuaState.L_CheckString怎么用?C# ILuaState.L_CheckString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILuaState
的用法示例。
在下文中一共展示了ILuaState.L_CheckString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Lua_ObjectMetaReader
private int Lua_ObjectMetaReader(ILuaState lua)
{
string key = lua.L_CheckString(2);
if (WidgetReadOper(lua, key))
return 1;
return 0;
}
示例2: Lua_ObjectMetaWriter
private int Lua_ObjectMetaWriter(ILuaState lua)
{
string key = lua.L_CheckString(2);
if (WidgetWriteOper(lua, key))
return 0;
lua.RawSet(1);
return 0;
}
示例3: WidgetWriteOper
protected override bool WidgetWriteOper(ILuaState lua, string key)
{
switch (key)
{
case "spName":
_normalInfo.spName = lua.L_CheckString(-1);
break;
case "distance":
_normalInfo.distance = (float)lua.L_CheckNumber(-1);
break;
default:
return base.WidgetWriteOper(lua, key);
}
return true;
}
示例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;
}
示例5: AddQuoted
private static void AddQuoted(ILuaState lua, StringBuilder sb, int arg)
{
var s = lua.L_CheckString(arg);
sb.Append('"');
for(var i=0; i<s.Length; ++i) {
var c = s[i];
if(c == '"' || c == '\\' || c == '\n') {
sb.Append('\\').Append(c);
}
else if(c == '\0' || Char.IsControl(c)) {
if(i+1>=s.Length || !Char.IsDigit(s[i+1])) {
sb.AppendFormat("\\{0:D}", (int)c);
}
else {
sb.AppendFormat("\\{0:D3}", (int)c);
}
}
else {
sb.Append(c);
}
}
sb.Append('"');
}
示例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: 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;
}
示例8: Lua_Init
// void OnGUI()
// {
// if (GUILayout.Button("chg"))
// {
// if (tt == 1)
// whRate = 1 / rate;
// else
// whRate = rate;
// _mesh.vertices = new Vector3[] { new Vector3(-width * whRate / 2, -height * whRate / 2, 0), new Vector3(width * whRate / 2, -height * whRate / 2, 0), new Vector3(width * whRate / 2, height * whRate / 2, 0), new Vector3(-width * whRate / 2, height * whRate / 2, 0) };
//
// }
// if (GUILayout.Button("resizeMesh"))
// {
// Camera cam = Camera.main;
// float distance = _meshFilter.transform.localPosition.z;
// float field = cam.fieldOfView;
// float h = distance * Mathf.Tan(field / 2 * Mathf.PI / 180)*2;
// float w = h*Screen.width/Screen.height;
// Debug.Log("===" + distance + ":" + field + ":" + w + ":" + h);
// chgSize(w, h, 1);
// }
// }
private int Lua_Init(ILuaState lua)
{
string spName = lua.L_CheckString(2);
float distance = (float)lua.L_CheckNumber(3);
transform.localPosition = new Vector3(0f, 0f, distance);
init(spName);
return 0;
}
示例9: WidgetWriteOper
/// //////////////////属性导出导入部分-有导入导出需求时重写///////////////////////////////////////////////
protected override bool WidgetWriteOper(ILuaState lua, string key)
{
switch (key)
{
case "talkInfo":
_normalInfo.talkInfo = lua.L_CheckString(-1);
break;
case "talkName":
_normalInfo.talkName = lua.L_CheckString(-1);
break;
case "bHideNext":
_normalInfo.bHideNext = lua.ToBoolean(-1);
break;
default:
return base.WidgetWriteOper(lua, key);
}
return true;
}
示例10: WidgetWriteOper
/// //////////////////属性导出导入部分-有导入导出需求时重写///////////////////////////////////////////////
protected override bool WidgetWriteOper(ILuaState lua, string key)
{
switch (key)
{
case "AnimName":
_normalInfo.AnimName = lua.L_CheckString(-1);
break;
case "speed":
_normalInfo.speed = (float)lua.L_CheckNumber(-1);
break;
case "nState":
_normalInfo.nState = lua.L_CheckInteger(-1);
break;
case "dwMMethod":
_normalInfo.dwMMethod = lua.L_CheckInteger(-1);
break;
default:
return base.WidgetWriteOper(lua, key);
}
return true;
}
示例11: WidgetWriteOper
/// //////////////////属性导出导入部分-有导入导出需求时重写///////////////////////////////////////////////
protected override bool WidgetWriteOper(ILuaState lua, string key)
{
switch (key)
{
case "descName":
_normalInfo.descName = lua.L_CheckString(-1);
break;
case "childName":
_normalInfo.childName = lua.L_CheckString(-1);
break;
case "localPosition":
_normalInfo.localPosition = LuaExport.GetVector3(lua, -1);
break;
default:
return base.WidgetWriteOper(lua, key);
}
return true;
}
示例12: Str_Gmatch
private static int Str_Gmatch( ILuaState lua )
{
lua.L_CheckString(1);
lua.L_CheckString(2);
lua.SetTop(2);
lua.PushInteger(0);
lua.PushCSharpClosure( GmatchAux, 3 );
return 1;
}
示例13: Str_Len
private static int Str_Len( ILuaState lua )
{
string s = lua.L_CheckString(1);
lua.PushInteger( s.Length );
return 1;
}
示例14: SearcherPreload
private static int SearcherPreload( ILuaState lua )
{
string name = lua.L_CheckString( 1 );
lua.GetField( LuaDef.LUA_REGISTRYINDEX, "_PRELOAD" );
lua.GetField( -1, name );
if( lua.IsNil(-1) ) // not found?
lua.PushString( string.Format(
"\n\tno field package.preload['{0}']", name ) );
return 1;
}
示例15: SearcherLua
private static int SearcherLua( ILuaState lua )
{
string name = lua.L_CheckString( 1 );
string filename = FindFile( lua, name, "path", LUA_LSUBSEP );
if( filename == null )
return 1;
return CheckLoad( lua,
(lua.L_LoadFile(filename) == ThreadStatus.LUA_OK),
filename );
}