[Function] Handling New Names (Name#0000) in Lua |
Shamousey « Consul » 1520385300000
| 7 | ||
I've seen some people are concerned about the new naming system which will change everyone's username to append a unique ID to the end of it, and what this means for modules. I wrote up a couple of quick functions that I plan to implement into #utility so that instead of having to type the full name in a command (eg. "!kill Shamousey#0000") you can still type the short name if there is only one player with that name in the room (eg "!kill Shamousey"). The main function, "user_in_list" will return one of the following values:
If you want to implement these functions into your own code to handle this kind of logic, here they are: 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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 --- Returns the split name and hashtag from an Atelier 801 username Dernière modification le 1520385540000 |
Shamousey « Consul » 1520385360000
| 6 | ||
To test and prove what they do, here are some assertions: 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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 local playerListAssociative = { |
Mercedestamy « Censeur » 1520385960000
| 2 | ||
wo, it's cool and pretty |
Kimsterjay « Consul » 1520419920000
| 3 | ||
Urghh.. |
Caphira « Censeur » 1520420580000
| 0 | ||
Nice adaption! |
Jack_sparrow « Censeur » 1520422500000
| 1 | ||
Thanks!! |
Yatsuki « Censeur » 1520422680000
| 1 | ||
thank you |
1 | ||
Nice, thank you !!! |
Bolodefchoco « Sénateur » 1520431560000
| 3 | ||
tragic update tho nice |
1 | ||
grax<3 |
Muutluerkek « Citoyen » 1520885820000
| 3 | ||
not cool new name system :/ |
Sebafrancuz « Consul » 1520925360000
| 1 | ||
Useful function, thank you Shamousey! |