/* ** this function can be called asynchronous (e.g. during a signal) */ public static int lua_sethook(LuaState L, lua_Hook func, int mask, int count) { if (func == null || mask == 0) { /* turn off hooks? */ mask = 0; func = null; } L.hook = func; L.basehookcount = count; resethookcount(L); L.hookmask = cast_byte(mask); return 1; }
/* ** this function can be called asynchronous (e.g. during a signal) */ public static int lua_sethook(lua_State L, lua_Hook func, int mask, int count) { if (func == null || mask == 0) /* turn off hooks? */ { mask = 0; func = null; } if (isLua(L.ci) != 0) { L.oldpc = L.ci.u.l.savedpc; } L.hook = func; L.basehookcount = count; resethookcount(L); L.hookmask = cast_byte(mask); return(1); }
private static int db_gethook(lua_State L) { int arg; lua_State L1 = getthread(L, out arg); CharPtr buff = new char[5]; int mask = lua_gethookmask(L1); lua_Hook hook = lua_gethook(L1); if (hook != null && hook != hookf) /* external hook? */ { lua_pushliteral(L, "external hook"); } else { gethooktable(L); lua_rawgetp(L, -1, L1); /* get hook */ lua_remove(L, -2); /* remove hook table */ } lua_pushstring(L, unmakemask(mask, buff)); lua_pushinteger(L, lua_gethookcount(L1)); return(3); }
[DllImport("lua")] extern public static void lua_sethook(IntPtr L, lua_Hook func, int mask, int count);
public static int lua_sethook(this LuaState luaState, lua_Hook f, int mask, int count) => Lua.lua_sethook(luaState, f, mask, count);
public static int lua_sethook(lua_Hook f, int mask, int count) => lua_sethook(_state, f, mask, count);
public static extern int lua_sethook(LuaState luaState, lua_Hook f, int mask, int count);
public extern static void lua_sethook(lua_State L, lua_Hook func, int mask, int count);
public static extern int lua_sethook(lua_State_ptr L, lua_Hook func, int mask, int count);
public static void lua_sethook(IntPtr L, lua_Hook func, int mask, int count) { IntPtr funcHook = func == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(func); NativeMethods.lua_sethook(L, funcHook, mask, count); }
public static int lua_sethook(IntPtr luaState, lua_Hook func, int mask, int count) { IntPtr funcHook = Marshal.GetFunctionPointerForDelegate(func); return(lua_sethook(luaState, funcHook, mask, count)); }
public static void lua_sethook(lua_State luaState, lua_Hook func, int mask, int count) => lua_sethook(luaState, func == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(func), mask, count);
public static extern int lua_sethook(lua_State L, lua_Hook func, int mask, int count);
public static extern int lua_sethook(IntPtr L, lua_Hook func, int mask, int count);