| 94 | |
| 95 | |
| 96 | Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { |
| 97 | Udata *u; |
| 98 | if (s > MAX_SIZET - sizeof(Udata)) |
| 99 | luaM_toobig(L); |
| 100 | u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata))); |
| 101 | u->uv.marked = luaC_white(G(L)); /* is not finalized */ |
| 102 | u->uv.tt = LUA_TUSERDATA; |
| 103 | u->uv.len = s; |
| 104 | u->uv.metatable = NULL; |
| 105 | u->uv.env = e; |
| 106 | /* chain it on udata list (after main thread) */ |
| 107 | u->uv.next = G(L)->mainthread->next; |
| 108 | G(L)->mainthread->next = obj2gco(u); |
| 109 | return u; |
| 110 | } |
| 111 |
no test coverage detected