Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] oh so you can nest functions?

[DiscordArchive] oh so you can nest functions?

[DiscordArchive] oh so you can nest functions?

Pages (3): 1 2 3 Next
rektbyfaith
Administrator
0
11-04-2022, 05:22 PM
#1
Archived author: jintao41 • Posted: 2022-11-04T17:22:33.361000+00:00
Original source

oh so you can nest functions?
rektbyfaith
11-04-2022, 05:22 PM #1

Archived author: jintao41 • Posted: 2022-11-04T17:22:33.361000+00:00
Original source

oh so you can nest functions?

rektbyfaith
Administrator
0
11-04-2022, 05:22 PM
#2
Archived author: Honey • Posted: 2022-11-04T17:22:56.045000+00:00
Original source

Load after as in just trade their places.
rektbyfaith
11-04-2022, 05:22 PM #2

Archived author: Honey • Posted: 2022-11-04T17:22:56.045000+00:00
Original source

Load after as in just trade their places.

rektbyfaith
Administrator
0
11-04-2022, 05:23 PM
#3
Archived author: Honey • Posted: 2022-11-04T17:23:14.818000+00:00
Original source

The elegant solution which avoids many problems is the array.
rektbyfaith
11-04-2022, 05:23 PM #3

Archived author: Honey • Posted: 2022-11-04T17:23:14.818000+00:00
Original source

The elegant solution which avoids many problems is the array.

rektbyfaith
Administrator
0
11-04-2022, 05:25 PM
#4
Archived author: Honey • Posted: 2022-11-04T17:25:06.758000+00:00
Original source

First line would be
`local myscriptname = {}`

And from there every declaration is placed inside that array.

`function myscriptname.SwitchZone( event, player, _, _ )`
rektbyfaith
11-04-2022, 05:25 PM #4

Archived author: Honey • Posted: 2022-11-04T17:25:06.758000+00:00
Original source

First line would be
`local myscriptname = {}`

And from there every declaration is placed inside that array.

`function myscriptname.SwitchZone( event, player, _, _ )`

rektbyfaith
Administrator
0
11-04-2022, 05:26 PM
#5
Archived author: jintao41 • Posted: 2022-11-04T17:26:04.926000+00:00
Original source

that way variables defined in one function are available to the other, but do not leave the array or touch other scripts, correct?
rektbyfaith
11-04-2022, 05:26 PM #5

Archived author: jintao41 • Posted: 2022-11-04T17:26:04.926000+00:00
Original source

that way variables defined in one function are available to the other, but do not leave the array or touch other scripts, correct?

rektbyfaith
Administrator
0
11-04-2022, 05:26 PM
#6
Archived author: Honey • Posted: 2022-11-04T17:26:26.804000+00:00
Original source

If it's local it all stays within that file
rektbyfaith
11-04-2022, 05:26 PM #6

Archived author: Honey • Posted: 2022-11-04T17:26:26.804000+00:00
Original source

If it's local it all stays within that file

rektbyfaith
Administrator
0
11-04-2022, 05:26 PM
#7
Archived author: Honey • Posted: 2022-11-04T17:26:56.164000+00:00
Original source

And yes, they're all available towards each other regardless of order.
rektbyfaith
11-04-2022, 05:26 PM #7

Archived author: Honey • Posted: 2022-11-04T17:26:56.164000+00:00
Original source

And yes, they're all available towards each other regardless of order.

rektbyfaith
Administrator
0
11-04-2022, 05:29 PM
#8
Archived author: jintao41 • Posted: 2022-11-04T17:29:04.313000+00:00
Original source

that is very helpful, thank you. For the logic part, do you have an idea why it saves new coordinates while the player does not switch zones? Or is that because I do not bind these variables to a player, as you suggested?
rektbyfaith
11-04-2022, 05:29 PM #8

Archived author: jintao41 • Posted: 2022-11-04T17:29:04.313000+00:00
Original source

that is very helpful, thank you. For the logic part, do you have an idea why it saves new coordinates while the player does not switch zones? Or is that because I do not bind these variables to a player, as you suggested?

rektbyfaith
Administrator
0
11-04-2022, 05:30 PM
#9
Archived author: jintao41 • Posted: 2022-11-04T17:30:18.739000+00:00
Original source

Meaning, I see why I should bind these to the player anyway, but might that be the reason it is saving new coordinates?
rektbyfaith
11-04-2022, 05:30 PM #9

Archived author: jintao41 • Posted: 2022-11-04T17:30:18.739000+00:00
Original source

Meaning, I see why I should bind these to the player anyway, but might that be the reason it is saving new coordinates?

rektbyfaith
Administrator
0
11-04-2022, 05:32 PM
#10
Archived author: Honey • Posted: 2022-11-04T17:32:45.831000+00:00
Original source

Currently you have a single variable, which is assigned a new value whenever ANY player changes the map.
Define them as arrays.

```lua
PlayerX = {}
```
```lua
PlayerX[ player:GetGUIDLow() ] = player:GetX()
```
rektbyfaith
11-04-2022, 05:32 PM #10

Archived author: Honey • Posted: 2022-11-04T17:32:45.831000+00:00
Original source

Currently you have a single variable, which is assigned a new value whenever ANY player changes the map.
Define them as arrays.

```lua
PlayerX = {}
```
```lua
PlayerX[ player:GetGUIDLow() ] = player:GetX()
```

Pages (3): 1 2 3 Next
Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)