Number changing to a table when passed into a function?
So I currently have this code here:
01 | if bestMatchId = = nil then |
02 | local NewMatch = { Players = { } , MapId = map, updateFunc = function (match, matchPos) |
03 | print ( "Firing update func with id" , matchPos) |
04 | MatchmakingService:FireAllClientsEvent(UPDATE_MATCH_DETAILS_EVENT, matchPos, match.MapId) |
05 | if #match.Players > = 1 then |
07 | local TS = game:GetService( "TeleportService" ) |
11 | repeat Attempt = Attempt + 1 CodeSuccess, TSCode = pcall ( function () TS:ReserveServer(PlaceIds [ map ] ) end ) until CodeSuccess = = true or Attempt > 5 |
13 | local TPSuccess, TpMessage |
15 | repeat TpAttempt = TpAttempt + 1 TPSuccess, TpMessage = pcall ( function () TS:TeleportToPrivateServer(PlaceIds [ map ] , TSCode, match.Players, "Start" , { } ) end ) if TPSuccess = = false then warn( "TP ERROR:" , TpMessage) end until TPSuccess = = true or TpAttempt > 5 |
16 | Matches [ matchPos ] = nil |
19 | table.insert(NewMatch.Players, player) |
20 | local pos = table.getn(Matches [ map ] ) + 1 |
21 | table.insert(Matches [ map ] , pos, NewMatch) |
23 | print ( "Firing update func with pos" , pos) |
24 | NewMatch:updateFunc(NewMatch, pos) |
It pretty much makes a new dictionary that represents a match, and it has a update function that is called each time the match is updated. When the match is initially created, it's inserted into the main table with all matches, and then prints "firing update func with pos insert pos in main table here", but in the update function itself when I run print("Firing update func with id", matchPos)
it prints out that the matchPos
part is a table, leading me to believe at some point Roblox is converting my number to a table somehow.