Skip to main content
GameDev.net gamedev.net
🔒 Locked

Extending State Machine with Lua

Started by templewulf Apr 12, 2006 at 8:59 AM 1 replies 400+ views
Original Post
templewulf
templewulf
So, I'm getting into Lua for the first time, but I've found that it requires a bit more work than my previous C++ framework. I'm still using C++ for various system managers (video, audio, logfiles, etc.), and I'm writing the game logic in Lua. The problem is that in my previous system, the CSystem class contained a polymorphic std::list >, with classes for CGameStateMenu, CGameStateField, CGameStateMap, etc. implementing IGameState. Now that I've chosen to implement game logic in Lua, I don't know how to reorganize my state classes. Is it possible for Lua tables/classes to inherit from "real" C++ classes and still support a polymorphic list? What solutions have any of you used when mixing C++ and scripting code? Do I even need state classes, or is there a more elegant solution I'm not aware of? Thanks in advance, TW
XBox 360 gamertag: templewulf feel free to add me!
templewulf
templewulf
Now that you say it, I don't know why I hadn't thought of it earlier. [lol] Though, now that a gamestate class varies on scripts, would I even need the abstract interface IGameState?

Thanks Emmanuel! I say Ratings++ to you!
XBox 360 gamertag: templewulf feel free to add me!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.