DataFormatter.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. /*
  3. This defines the DataFormatter type in the Lua global namespace
  4. The usage is to create a new DataFormatter, and set the FormatData variable on it to a function, where you return a rml string that will
  5. be the formatted data
  6. //method
  7. --this method is NOT called from any particular instance, use it as from the type
  8. DataFormatter DataFormatter.new([string name[, function FormatData]]) --both are optional, but if you pass in a function, you must also pass in a name first
  9. //setter
  10. --this is called from a specific instance (one returned from DataFormatter.new)
  11. DataFormatter.FormatData = function( {key=int,value=string} ) --where indexes are sequential, like an array of strings
  12. */
  13. #include <Rocket/Core/Lua/lua.hpp>
  14. #include <Rocket/Core/Lua/LuaType.h>
  15. #include "LuaDataFormatter.h"
  16. namespace Rocket {
  17. namespace Core {
  18. namespace Lua {
  19. typedef LuaDataFormatter DataFormatter;
  20. //for DataFormatter.new
  21. template<> void LuaType<DataFormatter>::extra_init(lua_State* L, int metatable_index);
  22. //method
  23. int DataFormatternew(lua_State* L);
  24. //setter
  25. int DataFormatterSetAttrFormatData(lua_State* L);
  26. RegType<DataFormatter> DataFormatterMethods[];
  27. luaL_reg DataFormatterGetters[];
  28. luaL_reg DataFormatterSetters[];
  29. }
  30. }
  31. }