diff options
Diffstat (limited to 'lobject.h')
| -rw-r--r-- | lobject.h | 16 |
1 files changed, 14 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.h,v 2.83 2013/12/04 12:15:22 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 2.85 2014/02/19 13:51:09 roberto Exp roberto $ |
| 3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -331,13 +331,25 @@ typedef union Udata { | |||
| 331 | L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ | 331 | L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ |
| 332 | struct { | 332 | struct { |
| 333 | CommonHeader; | 333 | CommonHeader; |
| 334 | lu_byte ttuv_; /* user value's tag */ | ||
| 334 | struct Table *metatable; | 335 | struct Table *metatable; |
| 335 | struct Table *env; | ||
| 336 | size_t len; /* number of bytes */ | 336 | size_t len; /* number of bytes */ |
| 337 | union Value user_; /* user value */ | ||
| 337 | } uv; | 338 | } uv; |
| 338 | } Udata; | 339 | } Udata; |
| 339 | 340 | ||
| 340 | 341 | ||
| 342 | #define setuservalue(L,u,o) \ | ||
| 343 | { const TValue *io=(o); Udata *iu = (u); \ | ||
| 344 | iu->uv.user_ = io->value_; iu->uv.ttuv_ = io->tt_; \ | ||
| 345 | checkliveness(G(L),io); } | ||
| 346 | |||
| 347 | |||
| 348 | #define getuservalue(L,u,o) \ | ||
| 349 | { TValue *io=(o); const Udata *iu = (u); \ | ||
| 350 | io->value_ = iu->uv.user_; io->tt_ = iu->uv.ttuv_; \ | ||
| 351 | checkliveness(G(L),io); } | ||
| 352 | |||
| 341 | 353 | ||
| 342 | /* | 354 | /* |
| 343 | ** Description of an upvalue for function prototypes | 355 | ** Description of an upvalue for function prototypes |
