I'm wondering whether or not its possible to print the unknown contents of a function. For example, if you have:
function aFunction(...) print(1) end
How do I extract the line, "print(1)" from the function, so I can print it afterwards? Thank you in advance for your help.
We can use variadic arguments, represented by '...' to help us with this
table1 = {} function appendToTable(tab, ...) local args = {...} for i, v in pairs(args) do table.insert(tab, v) end end appendToTable(table1, "xD", ":D", "lol") for _,v in pairs(table1) do print(v) end
Source: Variadic arguments