DataSource.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef ROCKETCORELUADATASOURCE_H
  2. #define ROCKETCORELUADATASOURCE_H
  3. /*
  4. This defines the DataSource type in the Lua global namespace
  5. //methods
  6. noreturn DataSource:NotifyRowAdd(string tablename, int firstadded, int numadded)
  7. noreturn DataSource:NotifyRemove(string tablename, int firstremoved, int numremoved)
  8. noreturn DataSource:NotifyRowChange(string tablename, int firstchanged, int numchanged)
  9. noreturn DataSource:NotifyRowChange(string tablename) --the same as above, but for all rows
  10. when you get an instance of this, you MUST set two functions:
  11. DataSource.GetNumRows = function(tablename) ....... end --returns an int
  12. DataSource.GetRow = function(tablename,index,columns) ......end
  13. --where columns is a numerically indexed table of strings, and the function needs to
  14. --return a table of numerically indexed strings
  15. */
  16. #include <Rocket/Core/Lua/LuaType.h>
  17. #include <Rocket/Core/Lua/lua.hpp>
  18. #include "LuaDataSource.h"
  19. namespace Rocket {
  20. namespace Core {
  21. namespace Lua {
  22. typedef LuaDataSource DataSource;
  23. int DataSourceNotifyRowAdd(lua_State* L, DataSource* obj);
  24. int DataSourceNotifyRowRemove(lua_State* L, DataSource* obj);
  25. int DataSourceNotifyRowChange(lua_State* L, DataSource* obj);
  26. int DataSourceSetAttrGetNumRows(lua_State* L);
  27. int DataSourceSetAttrGetRow(lua_State* L);
  28. RegType<DataSource> DataSourceMethods[];
  29. luaL_reg DataSourceGetters[];
  30. luaL_reg DataSourceSetters[];
  31. }
  32. }
  33. }
  34. #endif