/Tukui/modules/unitframes/core/oUF/private.lua

http://github.com/Asphyxia/Tukui · Lua · 22 lines · 19 code · 3 blank · 0 comment · 4 complexity · 1cea86a07da0112d3714bf30baa50701 MD5 · raw file

  1. local parent, ns = ...
  2. local Private = ns.oUF.Private
  3. function Private.argcheck(value, num, ...)
  4. assert(type(num) == 'number', "Bad argument #2 to 'argcheck' (number expected, got "..type(num)..")")
  5. for i=1,select("#", ...) do
  6. if type(value) == select(i, ...) then return end
  7. end
  8. local types = strjoin(", ", ...)
  9. local name = string.match(debugstack(2,2,0), ": in function [`<](.-)['>]")
  10. error(("Bad argument #%d to '%s' (%s expected, got %s"):format(num, name, types, type(value)), 3)
  11. end
  12. function Private.print(...)
  13. print("|cff33ff99oUF:|r", ...)
  14. end
  15. function Private.error(...)
  16. Private.print("|cffff0000Error:|r "..string.format(...))
  17. end