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


C# lua_State类代码示例

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


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

示例1: db_getmetatable

 private static int db_getmetatable (lua_State L) {
     luaL_checkany(L, 1);
     if (lua_getmetatable(L, 1) == 0) {
         lua_pushnil(L);  /* no metatable */
     }
     return 1;
 }
开发者ID:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:7,代码来源:ldblib.cs

示例2: luaH_free

 public static void luaH_free(lua_State L, Table t)
 {
     if (t.node[0] != dummynode)
     luaM_freearray(L, t.node);
       luaM_freearray(L, t.array);
       luaM_free(L, t);
 }
开发者ID:TrentSterling,项目名称:kopilua,代码行数:7,代码来源:ltable.cs

示例3: luaF_freeclosure

 // we have a gc, so nothing to do
 public static void luaF_freeclosure(lua_State L, Closure c)
 {
     int size = (c.c.isC != 0) ? sizeCclosure(c.c.nupvalues) :
                           sizeLclosure(c.l.nupvalues);
       //luaM_freemem(L, c, size);
       SubtractTotalBytes(L, size);
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:8,代码来源:lfunc.cs

示例4: inc_ci

 public static CallInfo inc_ci(lua_State L)
 {
     if (L.ci == L.end_ci) return growCI(L);
     //   (condhardstacktests(luaD_reallocCI(L, L.size_ci)), ++L.ci))
     CallInfo.inc(ref L.ci);
     return L.ci;
 }
开发者ID:WondermSwift,项目名称:kopilua-1,代码行数:7,代码来源:ldo.cs

示例5: luaS_resize

		public static void luaS_resize (lua_State 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:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:30,代码来源:lstring.cs

示例6: luaF_findupval

 public static UpVal luaF_findupval(lua_State L, StkId level)
 {
     global_State 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:raymanyu,项目名称:kopilua,代码行数:28,代码来源:lfunc.cs

示例7: luaG_aritherror

 public static void luaG_aritherror(lua_State L, TValue p1, TValue p2)
 {
     TValue temp = new TValue();
       if (luaV_tonumber(p1, temp) == null)
     p2 = p1;  /* first operand is wrong */
       luaG_typeerror(L, p2, "perform arithmetic on");
 }
开发者ID:lenzener,项目名称:LuaInterface,代码行数:7,代码来源:ldebug.cs

示例8: os_clock

 private static int os_clock(lua_State L)
 {
     TimeSpan elapsed = DateTime.Now - start_time;
       long ticks = elapsed.Ticks / TimeSpan.TicksPerMillisecond;
       lua_pushnumber(L, ((lua_Number)ticks)/(lua_Number)1000);
       return 1;
 }
开发者ID:sanyaade-embedded-systems,项目名称:kopiluainterface,代码行数:7,代码来源:loslib.cs

示例9: newlstr

		public static TString newlstr (lua_State 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:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:25,代码来源:lstring.cs

示例10: addfield

 private static void addfield(lua_State L, luaL_Buffer b, int i)
 {
     lua_rawgeti(L, 1, i);
       if (lua_isstring(L, -1)==0)
     luaL_error(L, "invalid value (%s) at index %d in table for " +
                   LUA_QL("concat"), luaL_typename(L, -1), i);
     luaL_addvalue(b);
 }
开发者ID:lenzener,项目名称:LuaInterface,代码行数:8,代码来源:ltablib.cs

示例11: db_setmetatable

 private static int db_setmetatable (lua_State L) {
     int t = lua_type(L, 2);
     luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,
                   "nil or table expected");
     lua_settop(L, 2);
     lua_pushboolean(L, lua_setmetatable(L, 1));
     return 1;
 }
开发者ID:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:8,代码来源:ldblib.cs

示例12: db_setfenv

 private static int db_setfenv (lua_State L) {
     luaL_checktype(L, 2, LUA_TTABLE);
     lua_settop(L, 2);
     if (lua_setfenv(L, 1) == 0)
         luaL_error(L, LUA_QL("setfenv") +
                    " cannot change environment of given object");
     return 1;
 }
开发者ID:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:8,代码来源:ldblib.cs

示例13: os_tmpname

		private static int os_tmpname (lua_State L) {
#if XBOX
		  luaL_error(L, "os_tmpname not supported on Xbox360");
#else
		  lua_pushstring(L, Path.GetTempFileName());
#endif
		  return 1;
		}
开发者ID:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:8,代码来源:loslib.cs

示例14: luaZ_init

 public static void luaZ_init(lua_State L, ZIO z, lua_Reader reader, object data)
 {
     z.L = L;
       z.reader = reader;
       z.data = data;
       z.n = 0;
       z.p = null;
 }
开发者ID:WondermSwift,项目名称:kopilua-1,代码行数:8,代码来源:lzio.cs

示例15: getboolfield

 private static int getboolfield(lua_State L, CharPtr key)
 {
     int res;
       lua_getfield(L, -1, key);
       res = lua_isnil(L, -1) ? -1 : lua_toboolean(L, -1);
       lua_pop(L, 1);
       return res;
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:8,代码来源:loslib.cs


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