Game Development Reference
In-Depth Information
either go through here or use script events. You can see the full implementation of
the class in the source code in the Source/GCC4/Actors/ directory. The files you want
are ScriptComponentInterface.h, BaseScriptComonent.h,andBaseScriptComponent.cpp.
Lua Development and Debugging
As your scripts become more complex, you will invariably need tools in order to
manage and debug them. The print() statement and debug logs will only get you
so far, so you need a way to set breakpoints in Lua functions, inspect the values of
variables and tables, and single-step through your scripts. Lua does provide a number
of debug hooks to be able to do this, but they can be tedious to use. What you really
need is a full IDE (Integrated Development Environment) made for Lua. There are a
few of them out there of varying levels of quality.
C++ for Debugging
I
ve worked at two separate companies that used Lua without having a
debugger. At Super-Ego Games, we just used print debugging, and any
complex code was written in C++ whether it belonged there or not. At
PlayFirst, we only used Lua for UI configurations, so a debugger wasn
'
t
necessary. If we had a debugger at either of these companies, we would
have gotten a lot more from Lua than we did. This was proven to me when
I worked at Planet Moon, where we had a fully featured Lua debugger. Trust
me, you can get away without a debugger for a little while, but not long.
'
The best I ' ve used by far is Decoda, by Unknown Worlds. It ' s fast, easy to use, and
has a large set of features for managing projects and debugging your Lua scripts. The
only down side is that it
s not free, although it still costs less than the price of a typi-
cal console game. If you
'
'
re at all serious about integrating Lua into your games, I
highly recommend this program.
Final Thoughts
This Lua integration is relatively simple, but it
s
important to note that I really only scratched the surface of Lua in this chapter.
There are a lot more things you can do with Lua and LuaPlus that I simply didn
'
s enough for you play around with. It
'
t
have the page count to cover, like co-routines, threads, and more. Make sure you go
through the reading section below and check out some of the material there. Remem-
ber to experiment!
'
 
 
 
Search WWH ::




Custom Search