| 1473 | } |
| 1474 | |
| 1475 | static int Sys_SetDebuggerLightweightHook(lua_State* L) |
| 1476 | { |
| 1477 | int index = 1; |
| 1478 | lua_State* L1 = L; |
| 1479 | if (lua_isthread(L, 1)) { |
| 1480 | L1 = lua_tothread(L, 1); |
| 1481 | index++; |
| 1482 | } |
| 1483 | luaL_checktype(L, index, LUA_TFUNCTION); |
| 1484 | lua_pushvalue(L, index); |
| 1485 | if (g_DebuggerLightweightHook) |
| 1486 | { |
| 1487 | dmScript::Unref(L, LUA_REGISTRYINDEX, g_DebuggerLightweightHook); |
| 1488 | g_DebuggerLightweightHook = 0; |
| 1489 | } |
| 1490 | g_DebuggerLightweightHook = dmScript::Ref(L, LUA_REGISTRYINDEX); |
| 1491 | |
| 1492 | lua_sethook(L1, Sys_DebuggerLightweightHook, LUA_MASKCALL, 0); |
| 1493 | return 0; |
| 1494 | } |
| 1495 | |
| 1496 | static const luaL_reg ScriptSys_methods[] = |
| 1497 | { |
nothing calls this directly
no test coverage detected