當前位置: 首頁>>代碼示例>>C#>>正文


C# ObjectTranslator.getRawNetObject方法代碼示例

本文整理匯總了C#中NLua.ObjectTranslator.getRawNetObject方法的典型用法代碼示例。如果您正苦於以下問題:C# ObjectTranslator.getRawNetObject方法的具體用法?C# ObjectTranslator.getRawNetObject怎麽用?C# ObjectTranslator.getRawNetObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NLua.ObjectTranslator的用法示例。


在下文中一共展示了ObjectTranslator.getRawNetObject方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: toString

		private static int toString (LuaCore.lua_State luaState, ObjectTranslator translator)
		{
			object obj = translator.getRawNetObject (luaState, 1);

			if (!obj.IsNull ())
				translator.push (luaState, obj.ToString () + ": " + obj.GetHashCode ());
			else
				LuaLib.lua_pushnil (luaState);

			return 1;
		}
開發者ID:Azhei,項目名稱:NLua,代碼行數:11,代碼來源:Metatables.cs

示例2: dumpStack

		/// <summary>
		/// Debug tool to dump the lua stack
		/// </summary>
		/// FIXME, move somewhere else
		public static void dumpStack (ObjectTranslator translator, LuaCore.lua_State luaState)
		{
			int depth = LuaLib.lua_gettop (luaState);
			Debug.WriteLine ("lua stack depth: " + depth);

			for (int i = 1; i <= depth; i++) {
				var type = LuaLib.lua_type (luaState, i);
				// we dump stacks when deep in calls, calling typename while the stack is in flux can fail sometimes, so manually check for key types
				string typestr = (type == LuaTypes.Table) ? "table" : LuaLib.lua_typename (luaState, type);
				string strrep = LuaLib.lua_tostring (luaState, i).ToString ();

				if (type == LuaTypes.UserData) {
					object obj = translator.getRawNetObject (luaState, i);
					strrep = obj.ToString ();
				}

#if WINDOWS_PHONE
                Debug.WriteLine("{0}: ({1}) {2}", i, typestr, strrep);
#elif !SILVERLIGHT
				Debug.Print ("{0}: ({1}) {2}", i, typestr, strrep);
#endif
			}
		}
開發者ID:Azhei,項目名稱:NLua,代碼行數:27,代碼來源:Metatables.cs

示例3: runFunctionDelegate

		private static int runFunctionDelegate (LuaCore.lua_State luaState, ObjectTranslator translator)
		{
			LuaCore.lua_CFunction func = (LuaCore.lua_CFunction)translator.getRawNetObject (luaState, 1);
			LuaLib.lua_remove (luaState, 1);
			return func (luaState);
		}
開發者ID:Azhei,項目名稱:NLua,代碼行數:6,代碼來源:Metatables.cs


注:本文中的NLua.ObjectTranslator.getRawNetObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。