PackForClient.h 721 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * api/netpacks/PackForClient.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../../LuaWrapper.h"
  12. #include "../../../../lib/NetPacks.h"
  13. namespace scripting
  14. {
  15. namespace api
  16. {
  17. namespace netpacks
  18. {
  19. template <typename Derived>
  20. class PackForClientProxy
  21. {
  22. public:
  23. static int toNetpackLight(lua_State * L)
  24. {
  25. typename Derived::UDataType object;
  26. LuaStack S(L);
  27. if(!S.tryGet(1, object))
  28. return S.retVoid();
  29. lua_settop(L, 0);
  30. lua_pushlightuserdata(L, static_cast<CPackForClient *>(object.get()));
  31. return 1;
  32. }
  33. };
  34. }
  35. }
  36. }