Advertisement
higbead

Country Code to Flag Emoji

Nov 28th, 2020 (edited)
1,317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. local codes = { -- if any unicode wizards know a better way of doing this lmk
  2.     A = '🇦',
  3.     B = '🇧',
  4.     C = '🇨',
  5.     D = '🇩',
  6.     E = '🇪',
  7.     F = '🇫',
  8.     G = '🇬',
  9.     H = '🇭',
  10.     I = '🇮',
  11.     J = '🇯',
  12.     K = '🇰',
  13.     L = '🇱',
  14.     M = '🇲',
  15.     N = '🇳',
  16.     O = '🇴',
  17.     P = '🇵',
  18.     Q = '🇶',
  19.     R = '🇷',
  20.     S = '🇸',
  21.     T = '🇹',
  22.     U = '🇺',
  23.     V = '🇻',
  24.     W = '🇼',
  25.     X = '🇽',
  26.     Y = '🇾',
  27.     Z = '🇿'
  28. }
  29.  
  30. return function(countryCode)
  31.     local mergingCodes = {}
  32.  
  33.     for index = 1, #countryCode do
  34.         local letter = string.upper(countryCode:sub(index, index))
  35.         table.insert(mergingCodes, codes[letter])
  36.     end
  37.  
  38.     return table.concat(mergingCodes, '')
  39. end
  40.  
  41. -- worth noting that the flag emojis may not appear unless they're actually placed on a gui
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement