diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib_debug.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/lib_debug.c b/src/lib_debug.c index ebe0691f..07b025af 100644 --- a/src/lib_debug.c +++ b/src/lib_debug.c | |||
| @@ -256,6 +256,31 @@ LJLIB_CF(debug_upvaluejoin) | |||
| 256 | return 0; | 256 | return 0; |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | #if LJ_52 | ||
| 260 | LJLIB_CF(debug_getuservalue) | ||
| 261 | { | ||
| 262 | TValue *o = L->base; | ||
| 263 | if (o < L->top && tvisudata(o)) | ||
| 264 | settabV(L, o, tabref(udataV(o)->env)); | ||
| 265 | else | ||
| 266 | setnilV(o); | ||
| 267 | L->top = o+1; | ||
| 268 | return 1; | ||
| 269 | } | ||
| 270 | |||
| 271 | LJLIB_CF(debug_setuservalue) | ||
| 272 | { | ||
| 273 | TValue *o = L->base; | ||
| 274 | if (!(o < L->top && tvisudata(o))) | ||
| 275 | lj_err_argt(L, 1, LUA_TUSERDATA); | ||
| 276 | if (!(o+1 < L->top && tvistab(o+1))) | ||
| 277 | lj_err_argt(L, 2, LUA_TTABLE); | ||
| 278 | L->top = o+2; | ||
| 279 | lua_setfenv(L, 1); | ||
| 280 | return 1; | ||
| 281 | } | ||
| 282 | #endif | ||
| 283 | |||
| 259 | /* ------------------------------------------------------------------------ */ | 284 | /* ------------------------------------------------------------------------ */ |
| 260 | 285 | ||
| 261 | static const char KEY_HOOK = 'h'; | 286 | static const char KEY_HOOK = 'h'; |
