Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] hmm, but in your examples there the classname is nowhere as string, would that matter?

[DiscordArchive] hmm, but in your examples there the classname is nowhere as string, would that matter?

[DiscordArchive] hmm, but in your examples there the classname is nowhere as string, would that matter?

Pages (10): Previous 1 6 7 8 9 10 Next  
rektbyfaith
Administrator
0
05-16-2022, 06:04 PM
#71
Archived author: Foe • Posted: 2022-05-16T18:04:10.316000+00:00
Original source

```Lua
-- Parent class registry with global function to register and fetch classes
local classes = {}
function RegisterClass(class)
table.insert(classes, class)
end

function GetClasses()
return(classes)
end

-- Define class A and register
local A = {}
function A:get()
print(123)
end
RegisterClass(A)

-- Define class B and register
local B = {}
function B:get()
print("xyz")
end
RegisterClass(B)

-- Iterate over all classes and call get method
for k, v in pairs(GetClasses()) do
v:get()
end```
rektbyfaith
05-16-2022, 06:04 PM #71

Archived author: Foe • Posted: 2022-05-16T18:04:10.316000+00:00
Original source

```Lua
-- Parent class registry with global function to register and fetch classes
local classes = {}
function RegisterClass(class)
table.insert(classes, class)
end

function GetClasses()
return(classes)
end

-- Define class A and register
local A = {}
function A:get()
print(123)
end
RegisterClass(A)

-- Define class B and register
local B = {}
function B:get()
print("xyz")
end
RegisterClass(B)

-- Iterate over all classes and call get method
for k, v in pairs(GetClasses()) do
v:get()
end```

rektbyfaith
Administrator
0
05-16-2022, 06:04 PM
#72
Archived author: Grandold • Posted: 2022-05-16T18:04:13.625000+00:00
Original source

ye just happy to get any responses and help, I'm kinda thinking out loud here as a lot of stuff is new
rektbyfaith
05-16-2022, 06:04 PM #72

Archived author: Grandold • Posted: 2022-05-16T18:04:13.625000+00:00
Original source

ye just happy to get any responses and help, I'm kinda thinking out loud here as a lot of stuff is new

rektbyfaith
Administrator
0
05-16-2022, 06:04 PM
#73
Archived author: Grandold • Posted: 2022-05-16T18:04:32.034000+00:00
Original source

ye Foe ended up doing it that way
rektbyfaith
05-16-2022, 06:04 PM #73

Archived author: Grandold • Posted: 2022-05-16T18:04:32.034000+00:00
Original source

ye Foe ended up doing it that way

rektbyfaith
Administrator
0
05-16-2022, 06:04 PM
#74
Archived author: Foe • Posted: 2022-05-16T18:04:35.965000+00:00
Original source

That gives you local level storage of the object with two functions to register and return
rektbyfaith
05-16-2022, 06:04 PM #74

Archived author: Foe • Posted: 2022-05-16T18:04:35.965000+00:00
Original source

That gives you local level storage of the object with two functions to register and return

rektbyfaith
Administrator
0
05-16-2022, 06:04 PM
#75
Archived author: Foe • Posted: 2022-05-16T18:04:59.340000+00:00
Original source

Then you can require the framework wherever you define and call classes
rektbyfaith
05-16-2022, 06:04 PM #75

Archived author: Foe • Posted: 2022-05-16T18:04:59.340000+00:00
Original source

Then you can require the framework wherever you define and call classes

rektbyfaith
Administrator
0
05-16-2022, 06:06 PM
#76
Archived author: Grandold • Posted: 2022-05-16T18:06:11.209000+00:00
Original source

yeah it works that way atm, I was just aiming to some sort of solution where I wouldnt have to do anything inside the A and B file to register the classes, instead the file that handles loading of classes would somehow know how to do that
rektbyfaith
05-16-2022, 06:06 PM #76

Archived author: Grandold • Posted: 2022-05-16T18:06:11.209000+00:00
Original source

yeah it works that way atm, I was just aiming to some sort of solution where I wouldnt have to do anything inside the A and B file to register the classes, instead the file that handles loading of classes would somehow know how to do that

rektbyfaith
Administrator
0
05-16-2022, 06:06 PM
#77
Archived author: Grandold • Posted: 2022-05-16T18:06:44.944000+00:00
Original source

but as the "library" classes are local and I think I wanna keep it that way, it would be kinda tweaky
rektbyfaith
05-16-2022, 06:06 PM #77

Archived author: Grandold • Posted: 2022-05-16T18:06:44.944000+00:00
Original source

but as the "library" classes are local and I think I wanna keep it that way, it would be kinda tweaky

rektbyfaith
Administrator
0
05-16-2022, 06:06 PM
#78
Archived author: Foe • Posted: 2022-05-16T18:06:45.734000+00:00
Original source

That doesn't sound like a good approach
rektbyfaith
05-16-2022, 06:06 PM #78

Archived author: Foe • Posted: 2022-05-16T18:06:45.734000+00:00
Original source

That doesn't sound like a good approach

rektbyfaith
Administrator
0
05-16-2022, 06:07 PM
#79
Archived author: Grandold • Posted: 2022-05-16T18:07:06.349000+00:00
Original source

well i dunno, seen that kinds of autoloaders a lot
rektbyfaith
05-16-2022, 06:07 PM #79

Archived author: Grandold • Posted: 2022-05-16T18:07:06.349000+00:00
Original source

well i dunno, seen that kinds of autoloaders a lot

rektbyfaith
Administrator
0
05-16-2022, 06:07 PM
#80
Archived author: Foe • Posted: 2022-05-16T18:07:39.517000+00:00
Original source

yeah, Lua doesn't really work that way, unless you want to deal with your own file type and file io and string dumping on load
rektbyfaith
05-16-2022, 06:07 PM #80

Archived author: Foe • Posted: 2022-05-16T18:07:39.517000+00:00
Original source

yeah, Lua doesn't really work that way, unless you want to deal with your own file type and file io and string dumping on load

Pages (10): Previous 1 6 7 8 9 10 Next  
Recently Browsing
 
Recently Browsing