Advertisement
ViniCastilho

Untitled

Oct 16th, 2022 (edited)
943
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.95 KB | None | 0 0
  1. local site = (...);
  2.  
  3. site.bg = 0xE;
  4. site.fg = 0x6;
  5.  
  6. local format = _G.string.format;
  7. local tostring = _G.tostring;
  8. local ipairs = _G.ipairs;
  9.  
  10. local EMPTY_STRING = '';
  11. local WHITESPACE = ' ';
  12.  
  13. local STYLE_HEADER = {
  14.     center = true;
  15.     foregroundColor = 0xE;
  16.     backgroundColor = 0x6;
  17. };
  18.  
  19. local STYLE_BOLD = {
  20.     foregroundColor = 0x1;
  21. };
  22.  
  23. local function min(a, b)
  24.     if a >= b then return a; else return b; end
  25. end
  26.  
  27. local function candidate(uid, name, lang, role)
  28.     return {
  29.         ['uid'] = tostring(uid);
  30.         ['name'] = tostring(name);
  31.         ['lang'] = tostring(lang);
  32.         ['role'] = tostring(role);
  33.     };
  34. end
  35.  
  36. local function printCandidate(cand, style)
  37.     site:text("  UID........: "..cand.uid, style);
  38.     site:text("  NAME.......: "..cand.name, style);
  39.     site:text("  LANGUAGE(S): "..cand.lang, style);
  40.     site:text("  ROLE(S)....: "..cand.role, style);
  41. end
  42.  
  43. local personnel = {
  44.     candidate('256-2869', "ViniCastilho", "PT, EN",         "IT, DRIVER");
  45.     candidate('319-3338', "noche",        "TR, EN, RU, DE", "IT, MANAGER");
  46.     candidate('256-2679', "olv",          "RU, EN",         "IT, DRIVER");
  47. };
  48.  
  49. local personnelCount = #personnel;
  50.  
  51. function site:draw()
  52.     do --> HEADER
  53.         local padding = WHITESPACE:rep(22);
  54.         site:text(format("%sWELCOME TO hire.us%s", padding, padding), STYLE_HEADER);
  55.     end
  56.     site:text(EMPTY_STRING);
  57.     site:text("  This page is dedicated to advertising players by including");
  58.     site:text("  a brief description of them. Three candidates are shown at");
  59.     site:text("  a time. Reload the page to get a new set.");
  60.     site:text(format("  There are %i record(s) in total.", #personnel), STYLE_BOLD);
  61.     site:text(EMPTY_STRING);
  62.     do --> CANDIDATES
  63.         ---- No `math.random` function yet, I'm going insane...
  64.         for i = 1, 3 do
  65.             printCandidate(personnel[i]);
  66.             site:text(EMPTY_STRING);
  67.         end
  68.     end
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement