[DiscordArchive] This is your script ?
[DiscordArchive] This is your script ?
Archived author: Nix • Posted: 2022-01-22T11:18:17.009000+00:00
Original source
```lua
myTable = {};
local function DoStuff()
myTable:Test();
end
function myTable.Test()
print("Testing Stuff");
end
DoStuff();
```
Archived author: Nix • Posted: 2022-01-22T11:18:37.597000+00:00
Original source
The actual declaration of the function DoStuff is separate to it's invokation
![[Image: unknown.png?ex=690c8450&is=690b32d0&hm=7...65ed9791a&]](https://cdn.discordapp.com/attachments/415944535718494208/934406981962326046/unknown.png?ex=690c8450&is=690b32d0&hm=71b84596da66e7b62793e15b0066e97699d4abf7ee8b05fbaf0d13865ed9791a&)
Archived author: Dep • Posted: 2022-01-22T11:19:45.119000+00:00
Original source
![[Image: unknown.png?ex=690c8450&is=690b32d0&hm=7...65ed9791a&]](https://cdn.discordapp.com/attachments/415944535718494208/934406981962326046/unknown.png?ex=690c8450&is=690b32d0&hm=71b84596da66e7b62793e15b0066e97699d4abf7ee8b05fbaf0d13865ed9791a&)
Archived author: Intemporel • Posted: 2022-01-22T11:19:47.869000+00:00
Original source
This is what I try to say
If you declare the table before the call, but set the function after, it’s work !
It’s just hard to me to explain my idea
Archived author: Nix • Posted: 2022-01-22T11:21:46.946000+00:00
Original source
Yes, however it can be "hidden" better, so to speak, the actual declaration of the table do not have to be above in the file, but as you said instead it simply has to occur before the actual execution of the function.
```lua
local function DoStuff()
local myTable = someGlobalTable["myTable"];
myTable:Test();
end
local myTable = {};
someGlobalTable = { ["myTable"] = myTable };
function myTable.Test()
print("Testing Stuff");
end
DoStuff();
```
Archived author: Nix • Posted: 2022-01-22T11:22:26.771000+00:00
Original source
In the above example, you could also just not make myTable local, and it would work the same as my first example
Archived author: Nix • Posted: 2022-01-22T11:22:48.992000+00:00
Original source
```lua
local function DoStuff()
myTable:Test();
end
myTable = {};
function myTable.Test()
print("Testing Stuff");
end
DoStuff();
```
Archived author: Dep • Posted: 2022-01-22T11:31:57.173000+00:00
Original source
yo thanks for the help with the addon. if I forgot to say