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


C# LuaState类代码示例

本文整理汇总了C#中LuaState的典型用法代码示例。如果您正苦于以下问题:C# LuaState类的具体用法?C# LuaState怎么用?C# LuaState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Register

	public static void Register(LuaState L)
	{
		L.BeginClass(typeof(UnityEngine.UI.Selectable), typeof(UnityEngine.EventSystems.UIBehaviour));
		L.RegFunction("IsInteractable", IsInteractable);
		L.RegFunction("FindSelectable", FindSelectable);
		L.RegFunction("FindSelectableOnLeft", FindSelectableOnLeft);
		L.RegFunction("FindSelectableOnRight", FindSelectableOnRight);
		L.RegFunction("FindSelectableOnUp", FindSelectableOnUp);
		L.RegFunction("FindSelectableOnDown", FindSelectableOnDown);
		L.RegFunction("OnMove", OnMove);
		L.RegFunction("OnPointerDown", OnPointerDown);
		L.RegFunction("OnPointerUp", OnPointerUp);
		L.RegFunction("OnPointerEnter", OnPointerEnter);
		L.RegFunction("OnPointerExit", OnPointerExit);
		L.RegFunction("OnSelect", OnSelect);
		L.RegFunction("OnDeselect", OnDeselect);
		L.RegFunction("Select", Select);
		L.RegFunction("__eq", op_Equality);
		L.RegFunction("__tostring", ToLua.op_ToString);
		L.RegVar("allSelectables", get_allSelectables, null);
		L.RegVar("navigation", get_navigation, set_navigation);
		L.RegVar("transition", get_transition, set_transition);
		L.RegVar("colors", get_colors, set_colors);
		L.RegVar("spriteState", get_spriteState, set_spriteState);
		L.RegVar("animationTriggers", get_animationTriggers, set_animationTriggers);
		L.RegVar("targetGraphic", get_targetGraphic, set_targetGraphic);
		L.RegVar("interactable", get_interactable, set_interactable);
		L.RegVar("image", get_image, set_image);
		L.RegVar("animator", get_animator, null);
		L.EndClass();
	}
开发者ID:woshihuo12,项目名称:UnityHello,代码行数:31,代码来源:UnityEngine_UI_SelectableWrap.cs

示例2: Register

 public static void Register(LuaState L)
 {
     L.BeginClass(typeof(UnityEngine.UI.Dropdown.DropdownEvent), typeof(UnityEngine.Events.UnityEvent<int>));
     L.RegFunction("New", _CreateUnityEngine_UI_Dropdown_DropdownEvent);
     L.RegFunction("__tostring", ToLua.op_ToString);
     L.EndClass();
 }
开发者ID:yuisunn,项目名称:UnityCrazy,代码行数:7,代码来源:UnityEngine_UI_Dropdown_DropdownEventWrap.cs

示例3: lock

 /// <summary>Returns the given string's characters in their numeric ASCII representation.</summary>
 /// <param name="luaState">Pointer to lua_State struct.</param>
 /// <param name="inputString">The string to get the chars from.</param>
 /// <param name="startPos">The first character of the string to get the byte of.</param>
 /// <param name="endPos">The last character of the string to get the byte of.</param>
 /// <returns>Numerical bytes.</returns>
 public static byte[] @byte(LuaState luaState, string inputString, uint startPos = 1U, uint endPos = 1U)
 {
     lock (SyncRoot)
     {
         if (startPos > inputString.Length)
         {
             return null;
         }
         if (startPos < 1U)
         {
             startPos = 1U;
         }
         if (endPos < startPos)
         {
             endPos = startPos;
         }
         lua_getglobal(luaState, nameof(@string));
         lua_getfield(luaState, -1, nameof(@byte));
         lua_pushstring(luaState, inputString);
         lua_pushnumber(luaState, startPos);
         lua_pushnumber(luaState, endPos);
         int length = (int)(1 + (endPos - startPos));
         lua_pcall(luaState, 3, length);
         byte[] numericalBytes = new byte[length];
         for (int i = 0; i < length; ++i)
         {
             numericalBytes[i] = (byte)lua_tointeger(luaState, -1 - i);
         }
         return numericalBytes;
     }
 }
开发者ID:OmegaExtern,项目名称:gmod-csharp-binary-module,代码行数:37,代码来源:string.cs

示例4: Register

 public static void Register(LuaState L)
 {
     L.BeginStaticLibs("QualitySettings");
     L.RegFunction("GetQualityLevel", GetQualityLevel);
     L.RegFunction("SetQualityLevel", SetQualityLevel);
     L.RegFunction("IncreaseLevel", IncreaseLevel);
     L.RegFunction("DecreaseLevel", DecreaseLevel);
     L.RegFunction("__eq", op_Equality);
     L.RegVar("names", get_names, null);
     L.RegVar("pixelLightCount", get_pixelLightCount, set_pixelLightCount);
     L.RegVar("shadowProjection", get_shadowProjection, set_shadowProjection);
     L.RegVar("shadowCascades", get_shadowCascades, set_shadowCascades);
     L.RegVar("shadowDistance", get_shadowDistance, set_shadowDistance);
     L.RegVar("shadowCascade2Split", get_shadowCascade2Split, set_shadowCascade2Split);
     L.RegVar("shadowCascade4Split", get_shadowCascade4Split, set_shadowCascade4Split);
     L.RegVar("masterTextureLimit", get_masterTextureLimit, set_masterTextureLimit);
     L.RegVar("anisotropicFiltering", get_anisotropicFiltering, set_anisotropicFiltering);
     L.RegVar("lodBias", get_lodBias, set_lodBias);
     L.RegVar("maximumLODLevel", get_maximumLODLevel, set_maximumLODLevel);
     L.RegVar("particleRaycastBudget", get_particleRaycastBudget, set_particleRaycastBudget);
     L.RegVar("softVegetation", get_softVegetation, set_softVegetation);
     L.RegVar("realtimeReflectionProbes", get_realtimeReflectionProbes, set_realtimeReflectionProbes);
     L.RegVar("billboardsFaceCameraPosition", get_billboardsFaceCameraPosition, set_billboardsFaceCameraPosition);
     L.RegVar("maxQueuedFrames", get_maxQueuedFrames, set_maxQueuedFrames);
     L.RegVar("vSyncCount", get_vSyncCount, set_vSyncCount);
     L.RegVar("antiAliasing", get_antiAliasing, set_antiAliasing);
     L.RegVar("desiredColorSpace", get_desiredColorSpace, null);
     L.RegVar("activeColorSpace", get_activeColorSpace, null);
     L.RegVar("blendWeights", get_blendWeights, set_blendWeights);
     L.EndStaticLibs();
 }
开发者ID:zhangxiangsong,项目名称:some_work,代码行数:31,代码来源:UnityEngine_QualitySettingsWrap.cs

示例5: Register

 public static void Register(LuaState L)
 {
     L.BeginClass(typeof(UnityEngine.Animation), typeof(UnityEngine.Behaviour));
     L.RegFunction("Stop", Stop);
     L.RegFunction("Rewind", Rewind);
     L.RegFunction("Sample", Sample);
     L.RegFunction("IsPlaying", IsPlaying);
     L.RegFunction("get_Item", get_Item);
     L.RegFunction("Play", Play);
     L.RegFunction("CrossFade", CrossFade);
     L.RegFunction("Blend", Blend);
     L.RegFunction("CrossFadeQueued", CrossFadeQueued);
     L.RegFunction("PlayQueued", PlayQueued);
     L.RegFunction("AddClip", AddClip);
     L.RegFunction("RemoveClip", RemoveClip);
     L.RegFunction("GetClipCount", GetClipCount);
     L.RegFunction("SyncLayer", SyncLayer);
     L.RegFunction("GetEnumerator", GetEnumerator);
     L.RegFunction("GetClip", GetClip);
     L.RegFunction("New", _CreateUnityEngine_Animation);
     L.RegVar("this", _this, null);
     L.RegFunction("__eq", op_Equality);
     L.RegFunction("__tostring", Lua_ToString);
     L.RegVar("clip", get_clip, set_clip);
     L.RegVar("playAutomatically", get_playAutomatically, set_playAutomatically);
     L.RegVar("wrapMode", get_wrapMode, set_wrapMode);
     L.RegVar("isPlaying", get_isPlaying, null);
     L.RegVar("animatePhysics", get_animatePhysics, set_animatePhysics);
     L.RegVar("cullingType", get_cullingType, set_cullingType);
     L.RegVar("localBounds", get_localBounds, set_localBounds);
     L.EndClass();
 }
开发者ID:youxibuhaowana,项目名称:01ulua,代码行数:32,代码来源:UnityEngine_AnimationWrap.cs

示例6: luaF_findupval

		public static UpVal luaF_findupval (LuaState L, StkId level) {
		  GlobalState g = G(L);
		  GCObjectRef pp = new OpenValRef(L);
		  UpVal p;
		  UpVal uv;
		  while (pp.get() != null && (p = ngcotouv(pp.get())).v >= level) {
			lua_assert(p.v != p.u.value);
			if (p.v == level) {  /* found a corresponding upvalue? */
			  if (isdead(g, obj2gco(p)))  /* is it dead? */
				changewhite(obj2gco(p));  /* ressurect it */
			  return p;
			}
			pp = new NextRef(p);
		  }
		  uv = luaM_new<UpVal>(L);  /* not found: create a new one */
		  uv.tt = LUA_TUPVAL;
		  uv.marked = luaC_white(g);
		  uv.v = level;  /* current value lives in the stack */
		  uv.next = pp.get();  /* chain it in the proper position */
		  pp.set( obj2gco(uv) );
		  uv.u.l.prev = g.uvhead;  /* double link it in `uvhead' list */
		  uv.u.l.next = g.uvhead.u.l.next;
		  uv.u.l.next.u.l.prev = uv;
		  g.uvhead.u.l.next = uv;
		  lua_assert(uv.u.l.next.u.l.prev == uv && uv.u.l.prev.u.l.next == uv);
		  return uv;
		}
开发者ID:chenzuo,项目名称:SharpLua,代码行数:27,代码来源:lfunc.cs

示例7: Register

 public static void Register(LuaState L)
 {
     L.BeginClass(typeof(System.Collections.Generic.Dictionary<int,TestAccount>), typeof(System.Object), "AccountMap");
     L.RegFunction(".geti", get_Item);
     L.RegFunction("get_Item", get_Item);
     L.RegFunction(".seti", set_Item);
     L.RegFunction("set_Item", set_Item);
     L.RegFunction("Add", Add);
     L.RegFunction("Clear", Clear);
     L.RegFunction("ContainsKey", ContainsKey);
     L.RegFunction("ContainsValue", ContainsValue);
     L.RegFunction("GetObjectData", GetObjectData);
     L.RegFunction("OnDeserialization", OnDeserialization);
     L.RegFunction("Remove", Remove);
     L.RegFunction("TryGetValue", TryGetValue);
     L.RegFunction("GetEnumerator", GetEnumerator);
     L.RegFunction("New", _CreateSystem_Collections_Generic_Dictionary_int_TestAccount);
     L.RegVar("this", _this, null);
     L.RegFunction("__tostring", ToLua.op_ToString);
     L.RegVar("Count", get_Count, null);
     L.RegVar("Comparer", get_Comparer, null);
     L.RegVar("Keys", get_Keys, null);
     L.RegVar("Values", get_Values, null);
     L.EndClass();
 }
开发者ID:woshihuo12,项目名称:UnityHello,代码行数:25,代码来源:System_Collections_Generic_Dictionary_int_TestAccountWrap.cs

示例8: Register

	public static void Register(LuaState L)
	{
		L.BeginClass(typeof(ByteBuffer), typeof(System.Object));
		L.RegFunction("Close", Close);
		L.RegFunction("WriteByte", WriteByte);
		L.RegFunction("WriteInt", WriteInt);
		L.RegFunction("WriteShort", WriteShort);
		L.RegFunction("WriteLong", WriteLong);
		L.RegFunction("WriteFloat", WriteFloat);
		L.RegFunction("WriteDouble", WriteDouble);
		L.RegFunction("WriteString", WriteString);
		L.RegFunction("WriteBytes", WriteBytes);
		L.RegFunction("WriteBuffer", WriteBuffer);
		L.RegFunction("ReadByte", ReadByte);
		L.RegFunction("ReadInt", ReadInt);
		L.RegFunction("ReadShort", ReadShort);
		L.RegFunction("ReadLong", ReadLong);
		L.RegFunction("ReadFloat", ReadFloat);
		L.RegFunction("ReadDouble", ReadDouble);
		L.RegFunction("ReadString", ReadString);
		L.RegFunction("ReadBytes", ReadBytes);
		L.RegFunction("ReadBuffer", ReadBuffer);
		L.RegFunction("ToBytes", ToBytes);
		L.RegFunction("Flush", Flush);
		L.RegFunction("New", _CreateByteBuffer);
		L.RegFunction("__tostring", ToLua.op_ToString);
		L.EndClass();
	}
开发者ID:woshihuo12,项目名称:UnityHello,代码行数:28,代码来源:ByteBufferWrap.cs

示例9: luaS_resize

		public static void luaS_resize (LuaState L, int newsize) {
		  GCObject[] newhash;
		  stringtable tb;
		  int i;
		  if (G(L).gcstate == GCSsweepstring)
			return;  /* cannot resize during GC traverse */		  
		  newhash = new GCObject[newsize];
		  AddTotalBytes(L, newsize * GetUnmanagedSize(typeof(GCObjectRef)));
		  tb = G(L).strt;
		  for (i=0; i<newsize; i++) newhash[i] = null;

		  /* rehash */
		  for (i=0; i<tb.size; i++) {
			GCObject p = tb.hash[i];
			while (p != null) {  /* for each node in the list */
			  GCObject next = p.gch.next;  /* save next */
			  uint h = gco2ts(p).hash;
			  int h1 = (int)lmod(h, newsize);  /* new position */
			  lua_assert((int)(h%newsize) == lmod(h, newsize));
			  p.gch.next = newhash[h1];  /* chain it */
			  newhash[h1] = p;
			  p = next;
			}
		  }
		  //luaM_freearray(L, tb.hash);
		  if (tb.hash != null)
			  SubtractTotalBytes(L, tb.hash.Length * GetUnmanagedSize(typeof(GCObjectRef)));
		  tb.size = newsize;
		  tb.hash = newhash;
		}
开发者ID:chenzuo,项目名称:SharpLua,代码行数:30,代码来源:lstring.cs

示例10: newlstr

		public static TString newlstr (LuaState L, CharPtr str, uint l,
											   uint h) {
		  TString ts;
		  stringtable tb;
		  if (l+1 > MAX_SIZET /GetUnmanagedSize(typeof(char)))
		    luaM_toobig(L);
		  ts = new TString(new char[l+1]);
		  AddTotalBytes(L, (int)(l + 1) * GetUnmanagedSize(typeof(char)) + GetUnmanagedSize(typeof(TString)));
		  ts.tsv.len = l;
		  ts.tsv.hash = h;
		  ts.tsv.marked = luaC_white(G(L));
		  ts.tsv.tt = LUA_TSTRING;
		  ts.tsv.reserved = 0;
		  //memcpy(ts+1, str, l*GetUnmanagedSize(typeof(char)));
		  memcpy(ts.str.chars, str.chars, str.index, (int)l);
		  ts.str[l] = '\0';  /* ending 0 */
		  tb = G(L).strt;
		  h = (uint)lmod(h, tb.size);
		  ts.tsv.next = tb.hash[h];  /* chain new entry */
		  tb.hash[h] = obj2gco(ts);
		  tb.nuse++;
		  if ((tb.nuse > (int)tb.size) && (tb.size <= MAX_INT/2))
		    luaS_resize(L, tb.size*2);  /* too crowded */
		  return ts;
		}
开发者ID:chenzuo,项目名称:SharpLua,代码行数:25,代码来源:lstring.cs

示例11: Remove

		public void Remove (LuaState luaState)
		{
			if (!translators.ContainsKey (luaState))
				return;
			
			translators.Remove (luaState);
		}
开发者ID:wilcomega,项目名称:Unity3D-NLua,代码行数:7,代码来源:ObjectTranslatorPool.cs

示例12: Register

 public static void Register(LuaState L)
 {
     L.BeginStaticLibs("RenderSettings");
     L.RegFunction("__eq", op_Equality);
     L.RegVar("fog", get_fog, set_fog);
     L.RegVar("fogMode", get_fogMode, set_fogMode);
     L.RegVar("fogColor", get_fogColor, set_fogColor);
     L.RegVar("fogDensity", get_fogDensity, set_fogDensity);
     L.RegVar("fogStartDistance", get_fogStartDistance, set_fogStartDistance);
     L.RegVar("fogEndDistance", get_fogEndDistance, set_fogEndDistance);
     L.RegVar("ambientMode", get_ambientMode, set_ambientMode);
     L.RegVar("ambientSkyColor", get_ambientSkyColor, set_ambientSkyColor);
     L.RegVar("ambientEquatorColor", get_ambientEquatorColor, set_ambientEquatorColor);
     L.RegVar("ambientGroundColor", get_ambientGroundColor, set_ambientGroundColor);
     L.RegVar("ambientLight", get_ambientLight, set_ambientLight);
     L.RegVar("ambientIntensity", get_ambientIntensity, set_ambientIntensity);
     L.RegVar("ambientProbe", get_ambientProbe, set_ambientProbe);
     L.RegVar("reflectionIntensity", get_reflectionIntensity, set_reflectionIntensity);
     L.RegVar("reflectionBounces", get_reflectionBounces, set_reflectionBounces);
     L.RegVar("haloStrength", get_haloStrength, set_haloStrength);
     L.RegVar("flareStrength", get_flareStrength, set_flareStrength);
     L.RegVar("flareFadeSpeed", get_flareFadeSpeed, set_flareFadeSpeed);
     L.RegVar("skybox", get_skybox, set_skybox);
     L.RegVar("sun", get_sun, set_sun);
     L.RegVar("defaultReflectionMode", get_defaultReflectionMode, set_defaultReflectionMode);
     L.RegVar("defaultReflectionResolution", get_defaultReflectionResolution, set_defaultReflectionResolution);
     L.RegVar("customReflection", get_customReflection, set_customReflection);
     L.EndStaticLibs();
 }
开发者ID:yuisunn,项目名称:UnityCrazy,代码行数:29,代码来源:UnityEngine_RenderSettingsWrap.cs

示例13: Register

	public static void Register(LuaState L)
	{
		L.BeginClass(typeof(UnityEngine.UI.LoopVerticalScrollRect), typeof(UnityEngine.UI.LoopScrollRect));
		L.RegFunction("__eq", op_Equality);
		L.RegFunction("__tostring", ToLua.op_ToString);
		L.EndClass();
	}
开发者ID:woshihuo12,项目名称:UnityHello,代码行数:7,代码来源:UnityEngine_UI_LoopVerticalScrollRectWrap.cs

示例14: Start

 // Use this for initialization
 void Start()
 {
     //只是展示如何加载文件。不是推荐这么做
     LuaState l = new LuaState();
     string path = Application.dataPath + "/uLua/Examples/04_ScriptsFromFile/ScriptsFromFile02.lua";        
     l.DoFile(path);
 }
开发者ID:ZeroToken,项目名称:MyTools,代码行数:8,代码来源:ScriptsFromFile_02.cs

示例15: luaF_newupval

		public static UpVal luaF_newupval (LuaState L) {
		  UpVal uv = luaM_new<UpVal>(L);
		  luaC_link(L, obj2gco(uv), LUA_TUPVAL);
		  uv.v = uv.u.value;
		  setnilvalue(uv.v);
		  return uv;
		}
开发者ID:chenzuo,项目名称:SharpLua,代码行数:7,代码来源:lfunc.cs


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