34 template <typename Func> |
34 template <typename Func> |
35 void DefSQMethod(Squirrel *engine, Func function_proc, const char *function_name) |
35 void DefSQMethod(Squirrel *engine, Func function_proc, const char *function_name) |
36 { |
36 { |
37 using namespace SQConvert; |
37 using namespace SQConvert; |
38 engine->AddMethod(function_name, DefSQNonStaticCallback<CL, Func>, 0, NULL, &function_proc, sizeof(function_proc)); |
38 engine->AddMethod(function_name, DefSQNonStaticCallback<CL, Func>, 0, NULL, &function_proc, sizeof(function_proc)); |
|
39 } |
|
40 |
|
41 /** |
|
42 * This defines a method inside a class for Squirrel, which has access to the 'engine' (experts only!). |
|
43 */ |
|
44 template <typename Func> |
|
45 void DefSQAdvancedMethod(Squirrel *engine, Func function_proc, const char *function_name) |
|
46 { |
|
47 using namespace SQConvert; |
|
48 engine->AddMethod(function_name, DefSQAdvancedNonStaticCallback<CL, Func>, 0, NULL, &function_proc, sizeof(function_proc)); |
39 } |
49 } |
40 |
50 |
41 /** |
51 /** |
42 * This defines a method inside a class for Squirrel with defined the params. |
52 * This defines a method inside a class for Squirrel with defined the params. |
43 * @note If you define nparam, make sure that he first param is always 'x', |
53 * @note If you define nparam, make sure that he first param is always 'x', |