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


C# ILuaState.SetGlobal方法代码示例

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


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

示例1: 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;
		}
开发者ID:jaydenh,项目名称:UniLua,代码行数:23,代码来源:LuaTableLib.cs

示例2: dolibrary

 /*
 ** Calls 'require(name)' and stores the result in a global variable
 ** with the given name.
 */
 static LuaStatus dolibrary(ILuaState L, String name)
 {
     LuaStatus status;
     L.GetGlobal("require");
     L.PushString(name);
     status = docall(L, 1, 1);  /* call 'require(name)' */
     if (status == LuaStatus.OK)
         L.SetGlobal(name);  /* global[name] = require return */
     return report(L, status);
 }
开发者ID:ygrenier,项目名称:LuaN,代码行数:14,代码来源:Program.cs

示例3: createargtable

 /// <summary>
 /// Create the 'arg' table, which stores all arguments from the
 /// command line ('argv'). It should be aligned so that, at index 0,
 /// it has 'argv[script]', which is the script name. The arguments
 /// to the script (everything after 'script') go to positive indices;
 /// other arguments (before the script name) go to negative indices.
 /// If there is no script name, assume interpreter's name as base.
 /// </summary>
 static void createargtable(ILuaState L, String[] argv, int argc, int script)
 {
     int i, narg;
     if (script == argc) script = 0;  /* no script name? */
     narg = argc - (script + 1);  /* number of positive indices */
     L.CreateTable(narg, script + 1);
     for (i = 0; i < argc; i++)
     {
         L.PushString(argv[i]);
         L.RawSetI(-2, i - script);
     }
     L.SetGlobal("arg");
 }
开发者ID:ygrenier,项目名称:LuaN,代码行数:21,代码来源:Program.cs


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