Madvillainy
2007.07.15, 04:48 PM
Hello everyone, before I get to the matter at hand I want to take a few sentences to introduce myself to everyone here at the forums. My name is Sebastian Jensen, I am 20 years old and I am from Stockholm, Sweden. I work as a web developer (mostly writing PHP components for Joomla! web sites) but my free time is completely devoted to my hobby project: a X-COM: UFO Enemy Unknown inspired game written in C++ with SDL and OpenGL.
It has always been my ambition to keep this project as data-driven as possible. Therefore we have used tinyXML to parse XML files for practically all of our date. This means soldiers, items, skills and pretty much everything else currently has its own XML file with appropriate attributes.
However, I want to take this one step further and add Lua into the mix, so an XML file for an item will have a "link" to a Lua script that will be executed when it is used or equiped etc. etc.
So now I have 2 questions:
QUESTION ONE: I dont seem to find a XCode framwork package for Lua, so how do I go about including Lua into my project? Can I simply add the header file from the source code available at Lua.org? Don't I have to add a library to the linker too? I have only been working on a Mac platform for 2 months now, so I have no idea how to link stuff like this (with SDL and OpenGL I just added the appropriate XCode framworks ...)
QUESTION TWO: My current idea is to have a singleton class (something like CLuaVirtualMachine) that handles all Lua scripts, but since I haven't really gotten my hands dirty with Lua yet I dont know if this is the best way of going about things. If you have implemented Lua in a object oriented project I would really like to hear how you have set things up ... my experience tells me that whatever I am doing there is a 95% chance someone else out there is already doing it, but better plus I just love reading about smart code solutions, so if you have any, bring it!
Thats it for now. I am glad I finally got around registering here and I look forward to be an active member of these forums...
Thanks in advance,
Sebastian Jensen AKA Madvillainy
It has always been my ambition to keep this project as data-driven as possible. Therefore we have used tinyXML to parse XML files for practically all of our date. This means soldiers, items, skills and pretty much everything else currently has its own XML file with appropriate attributes.
However, I want to take this one step further and add Lua into the mix, so an XML file for an item will have a "link" to a Lua script that will be executed when it is used or equiped etc. etc.
So now I have 2 questions:
QUESTION ONE: I dont seem to find a XCode framwork package for Lua, so how do I go about including Lua into my project? Can I simply add the header file from the source code available at Lua.org? Don't I have to add a library to the linker too? I have only been working on a Mac platform for 2 months now, so I have no idea how to link stuff like this (with SDL and OpenGL I just added the appropriate XCode framworks ...)
QUESTION TWO: My current idea is to have a singleton class (something like CLuaVirtualMachine) that handles all Lua scripts, but since I haven't really gotten my hands dirty with Lua yet I dont know if this is the best way of going about things. If you have implemented Lua in a object oriented project I would really like to hear how you have set things up ... my experience tells me that whatever I am doing there is a 95% chance someone else out there is already doing it, but better plus I just love reading about smart code solutions, so if you have any, bring it!
Thats it for now. I am glad I finally got around registering here and I look forward to be an active member of these forums...
Thanks in advance,
Sebastian Jensen AKA Madvillainy