[DiscordArchive] if its global, how would i then make some other function run after executing it?
[DiscordArchive] if its global, how would i then make some other function run after executing it?
Archived author: Foe • Posted: 2022-04-21T13:39:23.558000+00:00
Original source
a local function is tied to the local scope of the script
Archived author: Grandold • Posted: 2022-04-21T13:40:00.164000+00:00
Original source
okay, was just thinking if requiring it would make it kinda into the same scope but would be too easy I guess
Archived author: Foe • Posted: 2022-04-21T13:40:04.241000+00:00
Original source
In that case you would have to have a global function that exposes the local function globally
Archived author: Foe • Posted: 2022-04-21T13:40:10.355000+00:00
Original source
Nah
Archived author: Foe • Posted: 2022-04-21T13:40:27.407000+00:00
Original source
require just makes sure that the required script is loaded before the script requiring it
Archived author: Grandold • Posted: 2022-04-21T13:40:48.110000+00:00
Original source
okay, thanks a lot both of u! ^^
Archived author: Foe • Posted: 2022-04-21T13:41:12.276000+00:00
Original source
https://www.lua.org/cgi-bin/demo
```Lua
function FunctionA(arg1, arg2)
print(arg1, arg2)
end
local function functionXYZ()
print("extra")
-- do stuff
end
local origFunctionA = FunctionA;
FunctionA = function(...)
origFunctionA(...);
functionXYZ()
end
FunctionA("foo", "bar")```
Archived author: Foe • Posted: 2022-04-21T13:41:18.708000+00:00
Original source
Easy way to see how it works
Archived author: Grandold • Posted: 2022-04-21T13:41:51.296000+00:00
Original source
aaa thanks again, was actually thinking if there is some online tool to test script execution
Archived author: Grandold • Posted: 2022-04-21T13:44:36.595000+00:00
Original source
(...) part in function calls just pushes all the parameters given into the one being called with that too?