diff options
Diffstat (limited to 'src/script/squirrel_class.hpp')
-rw-r--r-- | src/script/squirrel_class.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/script/squirrel_class.hpp b/src/script/squirrel_class.hpp index 73117b60a..55efcdf13 100644 --- a/src/script/squirrel_class.hpp +++ b/src/script/squirrel_class.hpp @@ -72,6 +72,16 @@ public: } /** + * This defines a static method inside a class for Squirrel, which has access to the 'engine' (experts only!). + */ + template <typename Func> + void DefSQAdvancedStaticMethod(Squirrel *engine, Func function_proc, const char *function_name) + { + using namespace SQConvert; + engine->AddMethod(function_name, DefSQAdvancedStaticCallback<CL, Func>, 0, NULL, &function_proc, sizeof(function_proc)); + } + + /** * 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 |