本文整理汇总了C#中ILuaState.L_NewLib方法的典型用法代码示例。如果您正苦于以下问题:C# ILuaState.L_NewLib方法的具体用法?C# ILuaState.L_NewLib怎么用?C# ILuaState.L_NewLib使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILuaState
的用法示例。
在下文中一共展示了ILuaState.L_NewLib方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OpenLib
public static int OpenLib( ILuaState lua )
{
var define = new NameFuncPair[]
{
new NameFuncPair( "clear_assembly_list", FFI_ClearAssemblyList ),
new NameFuncPair( "add_assembly", FFI_AddAssembly ),
new NameFuncPair( "clear_using_list", FFI_ClearUsingList ),
new NameFuncPair( "using", FFI_Using ),
new NameFuncPair( "parse_signature", FFI_ParseSignature ),
new NameFuncPair( "get_type", FFI_GetType ),
new NameFuncPair( "get_constructor", FFI_GetConstructor ),
new NameFuncPair( "get_static_method", FFI_GetStaticMethod ),
new NameFuncPair( "get_method", FFI_GetMethod ),
new NameFuncPair( "call_method", FFI_CallMethod ),
new NameFuncPair( "get_field", FFI_GetField ),
new NameFuncPair( "get_field_value", FFI_GetFieldValue ),
new NameFuncPair( "set_field_value", FFI_SetFieldValue ),
new NameFuncPair( "get_prop", FFI_GetProp ),
new NameFuncPair( "get_static_prop", FFI_GetStaticProp ),
new NameFuncPair( "get_prop_value", FFI_GetPropValue ),
new NameFuncPair( "set_prop_value", FFI_SetPropValue ),
// new NameFuncPair( "call_constructor", FFI_CallConstructor ),
};
lua.L_NewLib( define );
return 1;
}
示例2: OpenLib
public static int OpenLib( ILuaState lua )
{
NameFuncPair[] define = new NameFuncPair[]
{
new NameFuncPair( "byte", Str_Byte ),
new NameFuncPair( "char", Str_Char ),
new NameFuncPair( "dump", Str_Dump ),
new NameFuncPair( "find", Str_Find ),
new NameFuncPair( "format", Str_Format ),
new NameFuncPair( "gmatch", Str_Gmatch ),
new NameFuncPair( "gsub", Str_Gsub ),
new NameFuncPair( "len", Str_Len ),
new NameFuncPair( "lower", Str_Lower ),
new NameFuncPair( "match", Str_Match ),
new NameFuncPair( "rep", Str_Rep ),
new NameFuncPair( "reverse", Str_Reverse ),
new NameFuncPair( "sub", Str_Sub ),
new NameFuncPair( "upper", Str_Upper ),
};
lua.L_NewLib( define );
CreateMetaTable( lua );
return 1;
}
示例3: initLib
public static int initLib(ILuaState luaState)
{
var define = new NameFuncPair[]
{
new NameFuncPair("testLuaCall", testLuaCall),
};
luaState.L_NewLib(define);
return 1;
}
示例4: OpenLib
public static int OpenLib( ILuaState lua )
{
NameFuncPair[] define = new NameFuncPair[]
{
new NameFuncPair( "traceback", DBG_Traceback ),
};
lua.L_NewLib( define );
return 1;
}
示例5: OpenLib
public static int OpenLib( ILuaState lua )
{
NameFuncPair[] define = new NameFuncPair[]
{
new NameFuncPair("clock", OS_Clock),
};
lua.L_NewLib( define );
return 1;
}
示例6: OpenLib
public static int OpenLib( ILuaState lua )
{
NameFuncPair[] define = new NameFuncPair[]
{
#if !UNITY_WEBPLAYER
new NameFuncPair("clock", OS_Clock),
#endif
};
lua.L_NewLib( define );
return 1;
}
示例7: OpenLib
public static int OpenLib( ILuaState lua )
{
var define = new NameFuncPair[]
{
new NameFuncPair( "encode", ENC_Encode ),
new NameFuncPair( "decode", ENC_Decode ),
};
lua.L_NewLib( define );
lua.PushString( ENC_UTF8 );
lua.SetField( -2, "utf8" );
return 1;
}
示例8: OpenLib
public static int OpenLib( ILuaState lua )
{
NameFuncPair[] define = new NameFuncPair[]
{
new NameFuncPair( "create", CO_Create ),
new NameFuncPair( "resume", CO_Resume ),
new NameFuncPair( "running", CO_Running ),
new NameFuncPair( "status", CO_Status ),
new NameFuncPair( "wrap", CO_Wrap ),
new NameFuncPair( "yield", CO_Yield ),
};
lua.L_NewLib( define );
return 1;
}
示例9: OpenLib
public static int OpenLib( ILuaState lua )
{
NameFuncPair[] define = new NameFuncPair[]
{
new NameFuncPair( "abs", Math_Abs ),
new NameFuncPair( "acos", Math_Acos ),
new NameFuncPair( "asin", Math_Asin ),
new NameFuncPair( "atan2", Math_Atan2 ),
new NameFuncPair( "atan", Math_Atan ),
new NameFuncPair( "ceil", Math_Ceil ),
new NameFuncPair( "cosh", Math_Cosh ),
new NameFuncPair( "cos", Math_Cos ),
new NameFuncPair( "deg", Math_Deg ),
new NameFuncPair( "exp", Math_Exp ),
new NameFuncPair( "floor", Math_Floor ),
new NameFuncPair( "fmod", Math_Fmod ),
new NameFuncPair( "frexp", Math_Frexp ),
new NameFuncPair( "ldexp", Math_Ldexp ),
new NameFuncPair( "log10", Math_Log10 ),
new NameFuncPair( "log", Math_Log ),
new NameFuncPair( "max", Math_Max ),
new NameFuncPair( "min", Math_Min ),
new NameFuncPair( "modf", Math_Modf ),
new NameFuncPair( "pow", Math_Pow ),
new NameFuncPair( "rad", Math_Rad ),
new NameFuncPair( "random", Math_Random ),
new NameFuncPair( "randomseed", Math_RandomSeed ),
new NameFuncPair( "sinh", Math_Sinh ),
new NameFuncPair( "sin", Math_Sin ),
new NameFuncPair( "sqrt", Math_Sqrt ),
new NameFuncPair( "tanh", Math_Tanh ),
new NameFuncPair( "tan", Math_Tan ),
};
lua.L_NewLib( define );
lua.PushNumber( Math.PI );
lua.SetField( -2, "pi" );
lua.PushNumber( Double.MaxValue );
lua.SetField( -2, "huge" );
RandObj = new Random();
return 1;
}
示例10: OpenLib
public static int OpenLib( ILuaState lua )
{
NameFuncPair[] define = new NameFuncPair[]
{
new NameFuncPair( "arshift", LuaBitLib.B_ArithShift ),
new NameFuncPair( "band", LuaBitLib.B_And ),
new NameFuncPair( "bnot", LuaBitLib.B_Not ),
new NameFuncPair( "bor", LuaBitLib.B_Or ),
new NameFuncPair( "bxor", LuaBitLib.B_Xor ),
new NameFuncPair( "btest", LuaBitLib.B_Test ),
new NameFuncPair( "extract", LuaBitLib.B_Extract ),
new NameFuncPair( "lrotate", LuaBitLib.B_LeftRotate ),
new NameFuncPair( "lshift", LuaBitLib.B_LeftShift ),
new NameFuncPair( "replace", LuaBitLib.B_Replace ),
new NameFuncPair( "rrotate", LuaBitLib.B_RightRotate ),
new NameFuncPair( "rshift", LuaBitLib.B_RightShift ),
};
lua.L_NewLib( define );
return 1;
}
示例11: OpenLib
public static int OpenLib( ILuaState lua )
{
NameFuncPair[] define = new NameFuncPair[]
{
new NameFuncPair( "concat", TBL_Concat ),
new NameFuncPair( "maxn", TBL_MaxN ),
new NameFuncPair( "insert", TBL_Insert ),
new NameFuncPair( "pack", TBL_Pack ),
new NameFuncPair( "unpack", TBL_Unpack ),
new NameFuncPair( "remove", TBL_Remove ),
new NameFuncPair( "sort", TBL_Sort ),
};
lua.L_NewLib( define );
#if LUA_COMPAT_UNPACK
// _G.unpack = table.unpack
lua.GetField( -1, "unpack" );
lua.SetGlobal( "unpack" );
#endif
return 1;
}
示例12: initLib
public static int initLib(ILuaState luaState)
{
var define = new NameFuncPair[]
{
new NameFuncPair("setEffectCode", setEffectCode),
new NameFuncPair("getEffectCode",getEffectCode),
new NameFuncPair("setEffectCondition", setEffectCondition),
new NameFuncPair("getEffectConditon",getEffectCondition),
new NameFuncPair("setEffectCost", setEffectCost),
new NameFuncPair("getEffectCost",getEffectCost),
new NameFuncPair("setEffectTarget", setEffectTarget),
new NameFuncPair("getEffectTarget",getEffectTarget),
new NameFuncPair("setEffectOperation", setEffectOperation),
new NameFuncPair("getEffectOperation",getEffectOperation),
new NameFuncPair("getEventVO",getEventVO),
new NameFuncPair("getEventVOProperty",getEventVOProperty),
new NameFuncPair("getVOProperty",getVOProperty),
};
luaState.L_NewLib(define);
return 1;
}
示例13: OpenLib
public static int OpenLib( ILuaState lua )
{
// NameFuncPair[] define = new NameFuncPair[]
// {
// new NameFuncPair( "module", PKG_Module ),
// };
// lua.L_NewLib( define );
// // create table CLIBS to keep track of loaded C libraries
// lua.L_GetSubTable( LuaDef.LUA_REGISTRYINDEX, CLIBS );
// lua.CreateTable( 0, 1 ); // metatable for CLIBS
// lua.PushCSharpFunction
// create `package' table
NameFuncPair[] pkg_define = new NameFuncPair[]
{
new NameFuncPair( "loadlib", PKG_LoadLib ),
new NameFuncPair( "searchpath", PKG_SearchPath ),
new NameFuncPair( "seeall", PKG_SeeAll ),
};
lua.L_NewLib( pkg_define );
CreateSearchersTable( lua );
#if LUA_COMPAT_LOADERS
lua.PushValue( -1 ); // make a copy of `searchers' table
lua.SetField( -3, "loaders" ); // put it in field `loaders'
#endif
lua.SetField( -2, "searchers" ); // put it in field `searchers'
// set field `path'
SetPath( lua, "path", LUA_PATHVERSION, LUA_PATH, LUA_PATH_DEFAULT );
// set field `cpath'
SetPath( lua, "cpath", LUA_CPATHVERSION, LUA_CPATH, LUA_CPATH_DEFAULT );
// store config information
lua.PushString( string.Format("{0}\n{1}\n{2}\n{3}\n{4}\n",
LuaConf.LUA_DIRSEP,
LUA_PATH_SEP,
LUA_PATH_MARK,
LUA_EXEC_DIR,
LUA_IGMARK ) );
lua.SetField( -2, "config" );
// set field `loaded'
lua.L_GetSubTable( LuaDef.LUA_REGISTRYINDEX, "_LOADED" );
lua.SetField( -2, "loaded" );
// set field `preload'
lua.L_GetSubTable( LuaDef.LUA_REGISTRYINDEX, "_PRELOAD" );
lua.SetField( -2, "preload" );
lua.PushGlobalTable();
lua.PushValue( -2 ); // set `package' as upvalue for next lib
NameFuncPair[] loadLibFuncs = new NameFuncPair[]
{
new NameFuncPair( "module", LL_Module ),
new NameFuncPair( "require", LL_Require ),
};
lua.L_SetFuncs( loadLibFuncs, 1 ); // open lib into global table
lua.Pop( 1 ); // pop global table
return 1; // return `package' table
}
示例14: initLib
public static int initLib(ILuaState luaState)
{
var define = new NameFuncPair[]
{
new NameFuncPair("testLuaCall", testLuaCall),
new NameFuncPair("createEffect",createEffect),
new NameFuncPair("createBuff",createBuff),
new NameFuncPair("addEffectToBuff",addEffectToBuff),
new NameFuncPair("addBuffToUnit",addBuffToUnit),
new NameFuncPair("applyDamage",applyDamage),
new NameFuncPair("applyTranslate",applyTranslate),
new NameFuncPair("showChessboardDialog", showChessboardDialog),
new NameFuncPair("terrainTranslate", terrainTranslate)
};
luaState.L_NewLib(define);
return 1;
}