# DefSQClass< CL > Class Template Reference

The template to define classes in Squirrel. More...

`#include <squirrel_class.hpp>`

## Public Member Functions
| DefSQClass (const char *_classname)
template<typename Func>
void | DefSQMethod (Squirrel *engine, Func function_proc, const char *function_name)
| This defines a method inside a class for Squirrel.
template<typename Func>
void | DefSQAdvancedMethod (Squirrel *engine, Func function_proc, const char *function_name)
| This defines a method inside a class for Squirrel, which has access to the 'engine' (experts only!).
template<typename Func>
void | DefSQMethod (Squirrel *engine, Func function_proc, const char *function_name, int nparam, const char *params)
| This defines a method inside a class for Squirrel with defined params.
template<typename Func>
void | DefSQStaticMethod (Squirrel *engine, Func function_proc, const char *function_name)
| This defines a static method inside a class for Squirrel.
template<typename Func>
void | DefSQStaticMethod (Squirrel *engine, Func function_proc, const char *function_name, int nparam, const char *params)
| This defines a static method inside a class for Squirrel with defined params.
template<typename Var>
void | DefSQConst (Squirrel *engine, Var value, const char *var_name)
void | PreRegister (Squirrel *engine)
void | PreRegister (Squirrel *engine, const char *parent_class)
template<typename Func, int Tnparam>
void | AddConstructor (Squirrel *engine, const char *params)
void | PostRegister (Squirrel *engine)
## Private Attributes
const char * | classname

## Detailed Description

### template<class CL>
class DefSQClass< CL >

The template to define classes in Squirrel.

It takes care of the creation and calling of such classes, to make the AI Layer cleaner while having a powerful script as possible AI language.

Definition at line 21 of file squirrel_class.hpp.

## Member Function Documentation

template<class CL>
template<typename Func>

void DefSQClass< CL >::DefSQMethod | ( | Squirrel * | engine,
|  | Func | function_proc,
|  | const char * | function_name,
|  | int | nparam,
|  | const char * | params |
| ) |  |  | `[inline]`

This defines a method inside a class for Squirrel with defined params.

Note:
  If you define nparam, make sure that he first param is always 'x', which is the 'this' inside the function. This is hidden from the rest of the code, but without it calling your function will fail!

Definition at line 57 of file squirrel_class.hpp.

template<class CL>
template<typename Func>

void DefSQClass< CL >::DefSQStaticMethod | ( | Squirrel * | engine,
|  | Func | function_proc,
|  | const char * | function_name,
|  | int | nparam,
|  | const char * | params |
| ) |  |  | `[inline]`

This defines a static method inside a class for Squirrel with defined params.

Note:
  If you define nparam, make sure that he first param is always 'x', which is the 'this' inside the function. This is hidden from the rest of the code, but without it calling your function will fail!

Definition at line 80 of file squirrel_class.hpp.

The documentation for this class was generated from the following file:

- src/script/squirrel_class.hpp