Advertisement
kurozael

Codebase Example

Feb 8th, 2012
769
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. --[[
  2.     © 2011 CloudSixteen.com do not share, re-distribute or modify
  3.     without permission of its author (kurozael@gmail.com).
  4. --]]
  5.  
  6. --[[
  7.     @codebase Server
  8.     @details Provides an interface to the hints system.
  9.     @field stored A table containting a list of stored hints.
  10. --]]
  11. Clockwork.hint = Clockwork:NewLibrary("Hint");
  12. Clockwork.hint.stored = {};
  13.  
  14. --[[
  15.     @codebase Server
  16.     @details Add a new hint to the list.
  17.     @param String A unique identifier.
  18.     @param String The body of the hint.
  19.     @param Function A callback with the player as an argument, return false to hide.
  20. --]]
  21. function Clockwork.hint:Add(name, text, Callback)
  22.     self.stored[name] = {
  23.         Callback = Callback,
  24.         text = text
  25.     };
  26. end;
  27.  
  28. --[[
  29.     @codebase Server
  30.     @details Remove an existing hint from the list.
  31.     @param String A unique identifier.
  32. --]]
  33. function Clockwork.hint:Remove(name)
  34.     self.stored[name] = nil;
  35. end;
  36.  
  37. --[[
  38.     @codebase Server
  39.     @details Find a hint by its identifier.
  40.     @param String A unique identifier.
  41.     @returns Table The hint table matching the identifier.
  42. --]]
  43. function Clockwork.hint:Find(name)
  44.     return self.stored[name];
  45. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement