DataFormatter.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef ROCKETCORELUADATAFORMATTER_H
  2. #define ROCKETCORELUADATAFORMATTER_H
  3. /*
  4. This defines the DataFormatter type in the Lua global namespace
  5. 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
  6. be the formatted data
  7. //method
  8. --this method is NOT called from any particular instance, use it as from the type
  9. 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
  10. //setter
  11. --this is called from a specific instance (one returned from DataFormatter.new)
  12. DataFormatter.FormatData = function( {key=int,value=string} ) --where indexes are sequential, like an array of strings
  13. */
  14. #include <Rocket/Core/Lua/lua.hpp>
  15. #include <Rocket/Core/Lua/LuaType.h>
  16. #include "LuaDataFormatter.h"
  17. namespace Rocket {
  18. namespace Core {
  19. namespace Lua {
  20. typedef LuaDataFormatter DataFormatter;
  21. //for DataFormatter.new
  22. template<> void LuaType<DataFormatter>::extra_init(lua_State* L, int metatable_index);
  23. //method
  24. int DataFormatternew(lua_State* L);
  25. //setter
  26. int DataFormatterSetAttrFormatData(lua_State* L);
  27. RegType<DataFormatter> DataFormatterMethods[];
  28. luaL_reg DataFormatterGetters[];
  29. luaL_reg DataFormatterSetters[];
  30. }
  31. }
  32. }
  33. #endif