blob: d707f95e5c87290db92654d843b1a7a93cf89026 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
-- Inject.lua
-- This file gets injected into the Core plugin when testing the inter-plugin calls with the "testcall" command
-- However, since this is a .lua file, it also gets loaded into the Debuggers plugin, so we need to distinguish the two
--- Prints the specified table to the log, using the specified indent
-- Assumes there are no cycles in the table and all keys and values can be turned to strings
local function printTable(a_Table, a_Indent)
for k, v in pairs(a_Table) do
LOG(a_Indent .. "k = " .. tostring(k))
if (type(k) == "table") then
printTable(k, a_Indent .. " ")
end
LOG(a_Indent .. "v = " .. tostring(v))
if (type(v) == "table") then
printTable(v, a_Indent .. " ")
end
end
end
local function printParams(...)
LOG("printParams:")
for idx, param in ipairs({...}) do
LOG(" param" .. idx .. ": " .. tostring(param))
if (type(param) == "table") then
printTable(param, " ")
end
end
LOG("done")
return true
end
local pluginName = cPluginManager:Get():GetCurrentPlugin():GetName()
if (pluginName ~= "Debuggers") then
-- We're in the destination plugin
LOG("Loaded Inject.lua into " .. pluginName)
injectedPrintParams = printParams
return true
else
-- We're in the Debuggers plugin, do nothing
end
|