Book Image

Mastering CryENGINE

By : Michelle Martin
Book Image

Mastering CryENGINE

By: Michelle Martin

Overview of this book

Table of Contents (17 chapters)
Mastering CryENGINE
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Using script binds


The CryENGINE Lua script implementation provides many very useful script binds. A script bind is basically a C++ engine function that has been exposed to Lua. This way, you can have access to pretty much any CryENGINE functionality in your Lua scripts. Many script binds are already available, for example, to start sounds, animations, or to send commands to the AI system. You can also easily expose more functionalities by adding your own script binds. Exposing and using script bind functions is rather easy and straightforward.

Calling script binds

Using a script bind is quite easy. Simply call the script bind as you would call any other Lua function. For example, the following code is a system script bind function that simply shuts down the engine:

System.Quit()

Apart from the function name, you will need to know the global namespace for the script bind you want to call. In the aforementioned example, it is System. The name of the namespace is defined by the C++ code that defines...