×

Langue

Fermer
Atelier 801
  • Forums
  • Dev Tracker
  • Connexion
    • English Français
      Português do Brasil Español
      Türkçe Polski
      Magyar Română
      العربية Skandinavisk
      Nederlands Deutsch
      Bahasa Indonesia Русский
      中文 Filipino
      Lietuvių kalba 日本語
      Suomi עברית
      Italiano Česky
      Hrvatski Slovensky
      Български Latviešu
      Estonian
  • Langue
  • Forums
  • /
  • Transformice
  • /
  • Archives
  • /
  • [Module]tfm.get.room.playerList table does not update.
[Module]tfm.get.room.playerList table does not update.
Issey
« Citoyen »
1382765820000
    • Issey#0000
    • Profil
    • Derniers messages
#1
  0
Bug a dit :
tfm.exec.disableAutoNewGame(true)

for name,player in pairs(tfm.get.room.playerList) do
tfm.exec.bindKeyboard(name,87,true,true)
end

playerList=tfm.get.room.playerList

tfm.exec.newGame('0')

function eventKeyboard(name,key,down,x,y)
if(key==87) then --when z is pressed
if(playerList[name].isDead==false) then
print('isNotDead')
tfm.exec.killPlayer(name)
elseif(playerList[name].isDead==true) then
print('isDead')
tfm.exec.respawnPlayer(name)
end
end
end

.isDead doesn't update when killPlayer() or respawnPlayer is executed.

EDIT: Okay so it turns out playerList is the one that's not getting updated, not tfm.get.room.playerList
Epicshawty
« Citoyen »
1382816640000
    • Epicshawty#0000
    • Profil
    • Derniers messages
    • Tribu
#2
  0
I'm not backseat moderating or anything but Module bugs go here: Topic-383230
Shamousey
« Consul »
1382836440000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#3
  0
For future reference, this isn't a bug at all. When you define something in Lua, it'll essentially make a copy of what it is at the time you define it - you'd need to update it again yourself if you want to use another variable name.
Moepl
« Citoyen »
1382887800000
    • Moepl#0095
    • Profil
    • Derniers messages
#4
  0
Shamousey a dit :
For future reference, this isn't a bug at all. When you define something in Lua, it'll essentially make a copy of what it is at the time you define it - you'd need to update it again yourself if you want to use another variable name.

mhhm mostly correct but let's examine this:
a dit :

playerlist={}
playerlist.bestplayer={name="Shamousey"}
newdefinebestplayer=playerlist.bestplayer
newdefinebestplayer.name="Moepl"
newdefinebestplayer.x=200
playerlist.bestplayer.x=100
print(playerlist.bestplayer.name.." "..playerlist.bestplayer.x)
print(newdefinebestplayer.name.." "..newdefinebestplayer.x)

output:
Moepl 100
Moepl 100

Conclusion1: tables ARE mutable
Conclusion2: Tig could fix it.
Fahianyx
1522615500000
    • Fahianyx#0000
    • Profil
    • Derniers messages
    • Tribu
#5
[Modéré par Batt_mellamy, raison : Spam]
  • Forums
  • /
  • Transformice
  • /
  • Archives
  • /
  • [Module]tfm.get.room.playerList table does not update.
© Atelier801 2018

Equipe Conditions Générales d'Utilisation Politique de Confidentialité Contact

Version 1.27