Ejemplo n.º 1
0
 public static Udata luaS_newudata(lua_State L, uint s, Table e)
 {
     Udata u = new Udata();
     u.uv.marked = luaC_white(G(L));  /* is not finalized */
     u.uv.tt = LUA_TUSERDATA;
     u.uv.len = s;
     u.uv.metatable = null;
     u.uv.env = e;
     u.user_data = new byte[s];
     /* chain it on udata list (after main thread) */
     u.uv.next = G(L).mainthread.next;
     G(L).mainthread.next = obj2gco(u);
     return u;
 }
Ejemplo n.º 2
0
 public static Udata luaS_newudata(LuaState L, uint s, Table e)
 {
     Udata u = new Udata();
     u.uv.marked = LuaCWhite(G(L));  /* is not finalized */
     u.uv.tt = LUA_TUSERDATA;
     u.uv.len = s;
     u.uv.metatable = null;
     u.uv.env = e;
     u.user_data = new byte[s];
     AddTotalBytes(L, GetUnmanagedSize(typeof(Udata)) + sizeudata(u));
     /* chain it on udata list (after main thread) */
     u.uv.next = G(L).mainthread.next;
     G(L).mainthread.next = obj2gco(u);
     return u;
 }
Ejemplo n.º 3
0
		public static int sizeudata(Udata u) { return (int)u.len; }
Ejemplo n.º 4
0
		internal static Udata luaS_newudata(lua_State L, Type t, Table e)
		{
			Udata u = new Udata();
			u.uv.marked = luaC_white(G(L));  /* is not finalized */
			u.uv.tt = LUA_TUSERDATA;
			u.uv.len = 0;
			u.uv.metatable = null;
			u.uv.env = e;
			u.user_data = luaM_realloc_(L, t);
			AddTotalBytes(L, GetUnmanagedSize(typeof(Udata)));
			/* chain it on udata list (after main thread) */
			u.uv.next = G(L).mainthread.next;
			G(L).mainthread.next = obj2gco(u);
			return u;
		}
Ejemplo n.º 5
0
 public static int sizeudata(Udata u)
 {
     return((int)u.len);
 }
Ejemplo n.º 6
0
 /*
 **  Get the address of memory block inside 'Udata'.
 ** (Access to 'ttuv_' ensures that value is really a 'Udata'.)
 */
 public static object getudatamem(Udata u)
 {
     return(u.user_data);
 }
Ejemplo n.º 7
0
 public static uint sizeudata(Udata u)
 {
     return(sizeludata((u).len));
 }
Ejemplo n.º 8
0
 public static uint sizeudata(Udata u)
 {
     return(u.len);
 }