×

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
  • /
  • Modules
  • /
  • [Module API] Errors
« ‹ 17 / 17
[Module API] Errors
Heniyengui
« Citoyen »
1527182100000
    • Heniyengui#0000
    • Profil
    • Derniers messages
#321
  0
I don't think anyone will care about fixing this bug, but I am reporting it anyway.
When the first color in the text area, is the same as the border color, the text area completely disappears.
Athesdrake
« Citoyen »
1527194160000
    • Athesdrake#0000
    • Profil
    • Derniers messages
    • Tribu
#322
  1
The events are not called when they are not functions even if the events are callable (metatables, __call method).

Code Lua

1
2
3
4
5
6
7
8
9
10
11
event = {}
event.__index = event
function event.__call(self, name, command)
-- eventChatCommand
print(string.format('%s triggered the command "%s".', name, command))
end

eventChatCommand = setmetatable({}, event)
eventChatCommand('Athesdrake#0000', 'test') -- working

-- [Athesdrake#0000] !test → not working
Bolodefchoco
« Sénateur »
1527289320000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#323
  0
Heniyengui a dit :
I don't think anyone will care about fixing this bug, but I am reporting it anyway.
When the first color in the text area, is the same as the border color, the text area completely disappears.

If both are 0xFFFFFF, for example? :o


Athesdrake a dit :
The events are not called when they are not functions even if the events are callable (metatables, __call method).

Code Lua

1
2
3
4
5
6
7
8
9
10
11
event = {}
event.__index = event
function event.__call(self, name, command)
-- eventChatCommand
print(string.format('%s triggered the command "%s".', name, command))
end

eventChatCommand = setmetatable({}, event)
eventChatCommand('Athesdrake#0000', 'test') -- working

-- [Athesdrake#0000] !test → not working

Because you broke the old metatable that was set in the event, so it becomes a regular function
Athesdrake
« Citoyen »
1527346740000
    • Athesdrake#0000
    • Profil
    • Derniers messages
    • Tribu
#324
  1
Bolodefchoco a dit :
Because you broke the old metatable that was set in the event, so it becomes a regular function

I understand now why it wasn't working. ^^
Thanks to you I found a way to apply a metatable to an event !
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
event = {}
event.__index = event
function event.__call(self, name, command)
-- eventChatCommand
print(string.format('%s triggered the command "%s".', name, command))
end

function dummy(func)
return function(...) return func(...) end
end

eventChatCommand = dummy(setmetatable({}, event))
eventChatCommand('Athesdrake#0000', 'test') -- working

-- [Athesdrake#0000] !test → working !!

-- So now I can do something like that:
function event:test()
print('Working !')
end

tfm.get.eventMetatable = setmetatable({}, event)
eventChatCommand = dummy(tfm.get.eventMetatable)

tfm.get.eventMetatable:test() -- Working !
-- Edit: I think this way is better:
_eventChatCommand = setmetatable({}, event)
eventChatCommand = dummy(_eventChatCommand)

_eventChatCommand:test() -- Working !

Dernière modification le 1527347280000
King_seniru
« Censeur »
1566729360000
    • King_seniru#5890
    • Profil
    • Derniers messages
    • Tribu
#325
  0
Problems with removeJoint

I encountered this problem since last 2 updates. The game shows strange behaviours when calling that method. Sometimes it removes everything finely but another time it wont (for the same code).
To check if there is a wrong with my code i removed them using hard coded values, and still it shows these strange behaviour
Beckboo8
« Citoyen »
1578707760000
    • Beckboo8#5837
    • Profil
    • Derniers messages
#326
  0
I'm not the owner of it, nor do i have the code, but, i was just playing unotfm and after a round, the map changed to normal tfm maps, please help!
King_seniru
« Censeur »
1582442220000
    • King_seniru#5890
    • Profil
    • Derniers messages
    • Tribu
#327
  0
Beckboo8 a dit :
I'm not the owner of it, nor do i have the code, but, i was just playing unotfm and after a round, the map changed to normal tfm maps, please help!

Probably the game crashed. You may report it to the owner
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • [Module API] Errors
« ‹ 17 / 17
© Atelier801 2018

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

Version 1.27