Lines Matching +full:function +full:- +full:mask
25 ** hook function.
89 ** Auxiliary function used by several library functions: check for
90 ** an optional thread as function's first argument and set 'arg' with
101 return L; /* function will operate over current thread */ in getthread()
113 lua_setfield(L, -2, k); in settabss()
118 lua_setfield(L, -2, k); in settabsi()
123 lua_setfield(L, -2, k); in settabsb()
128 ** In function 'db_getinfo', the call to 'lua_getinfo' may push
130 ** these objects. Function 'treatstackoption' puts the result from
136 lua_rotate(L, -2, 1); /* exchange object and table */ in treatstackoption()
139 lua_setfield(L, -2, fname); /* put object into table */ in treatstackoption()
145 ** L1 needs stack space for an optional input (function) plus
146 ** two optional outputs (function and line table) from function
156 if (lua_isfunction(L, arg + 1)) { /* info about a function? */ in db_getinfo()
158 lua_pushvalue(L, arg + 1); /* move function to 'L1' stack */ in db_getinfo()
172 lua_setfield(L, -2, "source"); in db_getinfo()
206 int nvar = (int)luaL_checkinteger(L, arg + 2); /* local-variable index */ in db_getlocal()
207 if (lua_isfunction(L, arg + 1)) { /* function argument? */ in db_getlocal()
208 lua_pushvalue(L, arg + 1); /* push function */ in db_getlocal()
212 else { /* stack-level argument */ in db_getlocal()
223 lua_rotate(L, -2, 1); /* re-order */ in db_getlocal()
265 lua_insert(L, -(get+1)); /* no-op if get is false */ in auxupvalue()
312 luaL_argcheck(L, !lua_iscfunction(L, 1), 1, "Lua function expected"); in db_upvaluejoin()
313 luaL_argcheck(L, !lua_iscfunction(L, 3), 3, "Lua function expected"); in db_upvaluejoin()
320 ** Call hook function registered at hook table for the current
328 if (lua_rawget(L, -2) == LUA_TFUNCTION) { /* is there a hook function? */ in hookf()
329 lua_pushstring(L, hooknames[(int)ar->event]); /* push event name */ in hookf()
330 if (ar->currentline >= 0) in hookf()
331 lua_pushinteger(L, ar->currentline); /* push current line */ in hookf()
334 lua_call(L, 2, 0); /* call hook function */ in hookf()
340 ** Convert a string mask (for 'sethook') into a bit mask
343 int mask = 0; in makemask() local
344 if (strchr(smask, 'c')) mask |= LUA_MASKCALL; in makemask()
345 if (strchr(smask, 'r')) mask |= LUA_MASKRET; in makemask()
346 if (strchr(smask, 'l')) mask |= LUA_MASKLINE; in makemask()
347 if (count > 0) mask |= LUA_MASKCOUNT; in makemask()
348 return mask; in makemask()
353 ** Convert a bit mask (for 'gethook') into a string mask
355 static char *unmakemask (int mask, char *smask) { in unmakemask() argument
357 if (mask & LUA_MASKCALL) smask[i++] = 'c'; in unmakemask()
358 if (mask & LUA_MASKRET) smask[i++] = 'r'; in unmakemask()
359 if (mask & LUA_MASKLINE) smask[i++] = 'l'; in unmakemask()
366 int arg, mask, count; in db_sethook() local
371 func = NULL; mask = 0; count = 0; /* turn off hooks */ in db_sethook()
377 func = hookf; mask = makemask(smask, count); in db_sethook()
382 lua_setfield(L, -2, "__mode"); /** hooktable.__mode = "k" */ in db_sethook()
383 lua_pushvalue(L, -1); in db_sethook()
384 lua_setmetatable(L, -2); /* metatable(hooktable) = hooktable */ in db_sethook()
388 lua_pushvalue(L, arg + 1); /* value (hook function) */ in db_sethook()
389 lua_rawset(L, -3); /* hooktable[L1] = new Lua hook */ in db_sethook()
390 lua_sethook(L1, func, mask, count); in db_sethook()
399 int mask = lua_gethookmask(L1); in db_gethook() local
411 lua_rawget(L, -2); /* 1st result = hooktable[L1] */ in db_gethook()
412 lua_remove(L, -2); /* remove hook table */ in db_gethook()
414 lua_pushstring(L, unmakemask(mask, buff)); /* 2nd result = mask */ in db_gethook()
429 lua_writestringerror("%s\n", luaL_tolstring(L, -1, NULL)); in db_debug()
439 if (msg == NULL && !lua_isnoneornil(L, arg + 1)) /* non-string 'msg'? */ in db_traceback()