LuaInterface.h 1.2 KB

123456789101112131415161718192021222324252627
  1. #ifndef LUAINTERFACE_H
  2. #define LUAINTERFACE_H
  3. /*
  4. This will define the "Game" global table in Lua and some functions with it.
  5. In Lua, the skeleton definition of Game with the fake function definitions (because it calls c++ code) would look something like
  6. Game = Game or {} --so if something else made a "Game" table, we would save the previous table, and just add on to it
  7. Game.Shutdown = function() Shell::RequestExit() end
  8. Game.SetPaused = function(paused) GameDetails::SetPaused(paused) end --where paused is a bool
  9. Game.SetDifficulty = function(difficulty) GameDetails::SetDifficulty(difficulty) end --difficulty is a value from Game.difficulty
  10. Game.SetDefenderColour = function(colour) GameDetails::SetDefenderColour(colour) end --colour is of type Colourb
  11. Game.SubmitHighScore = function() HighScores::SubmitScore(stuff from GameDetails) end
  12. Game.SetHighScoreName = function(name) HighScore::SubmitName(name) end -- name is a string
  13. Game.difficulty = { "HARD" = GameDetails::HARD, "EASY" = GameDetails::EASY }
  14. */
  15. struct lua_State;
  16. class Game;
  17. class LuaInterface
  18. {
  19. public:
  20. static void Initialise(lua_State* L);
  21. static void InitGame(lua_State* L);
  22. };
  23. #endif