mirror of https://github.com/OpenTTD/OpenTTD
Codechange: remove manual param count; in all cases strlen(params) == nparams
parent
781187b8a6
commit
c7056866a3
|
@ -464,8 +464,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||||
foreach(STATIC_METHOD IN LISTS STATIC_METHODS)
|
foreach(STATIC_METHOD IN LISTS STATIC_METHODS)
|
||||||
string(REPLACE ":" ";" STATIC_METHOD "${STATIC_METHOD}")
|
string(REPLACE ":" ";" STATIC_METHOD "${STATIC_METHOD}")
|
||||||
list(GET STATIC_METHOD 0 FUNCNAME)
|
list(GET STATIC_METHOD 0 FUNCNAME)
|
||||||
list(GET STATIC_METHOD 1 ARGC)
|
list(GET STATIC_METHOD 1 TYPES)
|
||||||
list(GET STATIC_METHOD 2 TYPES)
|
|
||||||
string(LENGTH "${FUNCNAME}" LEN)
|
string(LENGTH "${FUNCNAME}" LEN)
|
||||||
math(EXPR LEN "${MLEN} - ${LEN}")
|
math(EXPR LEN "${MLEN} - ${LEN}")
|
||||||
if("${TYPES}" STREQUAL "v")
|
if("${TYPES}" STREQUAL "v")
|
||||||
|
@ -482,7 +481,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||||
if("${TYPES}" STREQUAL "v")
|
if("${TYPES}" STREQUAL "v")
|
||||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.DefSQAdvancedStaticMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\");")
|
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.DefSQAdvancedStaticMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\");")
|
||||||
else()
|
else()
|
||||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.DefSQStaticMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\",${SPACES}${ARGC}, \"${TYPES}\");")
|
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.DefSQStaticMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\",${SPACES}\"${TYPES}\");")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
if(MLEN)
|
if(MLEN)
|
||||||
|
@ -502,8 +501,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||||
foreach(METHOD IN LISTS METHODS)
|
foreach(METHOD IN LISTS METHODS)
|
||||||
string(REPLACE ":" ";" METHOD "${METHOD}")
|
string(REPLACE ":" ";" METHOD "${METHOD}")
|
||||||
list(GET METHOD 0 FUNCNAME)
|
list(GET METHOD 0 FUNCNAME)
|
||||||
list(GET METHOD 1 ARGC)
|
list(GET METHOD 1 TYPES)
|
||||||
list(GET METHOD 2 TYPES)
|
|
||||||
string(LENGTH "${FUNCNAME}" LEN)
|
string(LENGTH "${FUNCNAME}" LEN)
|
||||||
math(EXPR LEN "${MLEN} - ${LEN}")
|
math(EXPR LEN "${MLEN} - ${LEN}")
|
||||||
if("${TYPES}" STREQUAL "v")
|
if("${TYPES}" STREQUAL "v")
|
||||||
|
@ -520,7 +518,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||||
if("${TYPES}" STREQUAL "v")
|
if("${TYPES}" STREQUAL "v")
|
||||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.DefSQAdvancedMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\");")
|
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.DefSQAdvancedMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\");")
|
||||||
else()
|
else()
|
||||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.DefSQMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\",${SPACES}${ARGC}, \"${TYPES}\");")
|
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.DefSQMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\",${SPACES}\"${TYPES}\");")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
if(MLEN)
|
if(MLEN)
|
||||||
|
@ -687,9 +685,9 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||||
set(CLS_PARAM_2 "${TYPES}")
|
set(CLS_PARAM_2 "${TYPES}")
|
||||||
elseif("${FUNCNAME}" MATCHES "^_" AND NOT "${TYPES}" STREQUAL "v")
|
elseif("${FUNCNAME}" MATCHES "^_" AND NOT "${TYPES}" STREQUAL "v")
|
||||||
elseif(IS_STATIC)
|
elseif(IS_STATIC)
|
||||||
list(APPEND STATIC_METHODS "${FUNCNAME}:${LEN}:${TYPES}")
|
list(APPEND STATIC_METHODS "${FUNCNAME}:${TYPES}")
|
||||||
else()
|
else()
|
||||||
list(APPEND METHODS "${FUNCNAME}:${LEN}:${TYPES}")
|
list(APPEND METHODS "${FUNCNAME}:${TYPES}")
|
||||||
endif()
|
endif()
|
||||||
continue()
|
continue()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -50,8 +50,8 @@ template <> SQInteger PushClassName<AIInfo, ScriptType::AI>(HSQUIRRELVM vm) { sq
|
||||||
SQAIInfo.DefSQConst(engine, ScriptConfigFlags{ScriptConfigFlag::InGame}.base(), "AICONFIG_INGAME");
|
SQAIInfo.DefSQConst(engine, ScriptConfigFlags{ScriptConfigFlag::InGame}.base(), "AICONFIG_INGAME");
|
||||||
|
|
||||||
SQAIInfo.PostRegister(engine);
|
SQAIInfo.PostRegister(engine);
|
||||||
engine->AddMethod("RegisterAI", &AIInfo::Constructor, 2, "tx");
|
engine->AddMethod("RegisterAI", &AIInfo::Constructor, "tx");
|
||||||
engine->AddMethod("RegisterDummyAI", &AIInfo::DummyConstructor, 2, "tx");
|
engine->AddMethod("RegisterDummyAI", &AIInfo::DummyConstructor, "tx");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ SQInteger AIInfo::Constructor(HSQUIRRELVM vm)
|
/* static */ SQInteger AIInfo::Constructor(HSQUIRRELVM vm)
|
||||||
|
@ -130,7 +130,7 @@ bool AIInfo::CanLoadFromVersion(int version) const
|
||||||
/* Create the AILibrary class, and add the RegisterLibrary function */
|
/* Create the AILibrary class, and add the RegisterLibrary function */
|
||||||
engine->AddClassBegin("AILibrary");
|
engine->AddClassBegin("AILibrary");
|
||||||
engine->AddClassEnd();
|
engine->AddClassEnd();
|
||||||
engine->AddMethod("RegisterLibrary", &AILibrary::Constructor, 2, "tx");
|
engine->AddMethod("RegisterLibrary", &AILibrary::Constructor, "tx");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ SQInteger AILibrary::Constructor(HSQUIRRELVM vm)
|
/* static */ SQInteger AILibrary::Constructor(HSQUIRRELVM vm)
|
||||||
|
|
|
@ -42,7 +42,7 @@ template <> SQInteger PushClassName<GameInfo, ScriptType::GS>(HSQUIRRELVM vm) {
|
||||||
SQGSInfo.DefSQConst(engine, ScriptConfigFlags{ScriptConfigFlag::Developer}.base(), "CONFIG_DEVELOPER");
|
SQGSInfo.DefSQConst(engine, ScriptConfigFlags{ScriptConfigFlag::Developer}.base(), "CONFIG_DEVELOPER");
|
||||||
|
|
||||||
SQGSInfo.PostRegister(engine);
|
SQGSInfo.PostRegister(engine);
|
||||||
engine->AddMethod("RegisterGS", &GameInfo::Constructor, 2, "tx");
|
engine->AddMethod("RegisterGS", &GameInfo::Constructor, "tx");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ SQInteger GameInfo::Constructor(HSQUIRRELVM vm)
|
/* static */ SQInteger GameInfo::Constructor(HSQUIRRELVM vm)
|
||||||
|
@ -100,7 +100,7 @@ bool GameInfo::CanLoadFromVersion(int version) const
|
||||||
/* Create the GameLibrary class, and add the RegisterLibrary function */
|
/* Create the GameLibrary class, and add the RegisterLibrary function */
|
||||||
engine->AddClassBegin("GSLibrary");
|
engine->AddClassBegin("GSLibrary");
|
||||||
engine->AddClassEnd();
|
engine->AddClassEnd();
|
||||||
engine->AddMethod("RegisterLibrary", &GameLibrary::Constructor, 2, "tx");
|
engine->AddMethod("RegisterLibrary", &GameLibrary::Constructor, "tx");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ SQInteger GameLibrary::Constructor(HSQUIRRELVM vm)
|
/* static */ SQInteger GameLibrary::Constructor(HSQUIRRELVM vm)
|
||||||
|
|
|
@ -14,17 +14,17 @@ void SQAIController_Register(Squirrel *engine)
|
||||||
DefSQClass<ScriptController, ScriptType::AI> SQAIController("AIController");
|
DefSQClass<ScriptController, ScriptType::AI> SQAIController("AIController");
|
||||||
SQAIController.PreRegister(engine);
|
SQAIController.PreRegister(engine);
|
||||||
|
|
||||||
SQAIController.DefSQStaticMethod(engine, &ScriptController::GetTick, "GetTick", 1, ".");
|
SQAIController.DefSQStaticMethod(engine, &ScriptController::GetTick, "GetTick", ".");
|
||||||
SQAIController.DefSQStaticMethod(engine, &ScriptController::GetOpsTillSuspend, "GetOpsTillSuspend", 1, ".");
|
SQAIController.DefSQStaticMethod(engine, &ScriptController::GetOpsTillSuspend, "GetOpsTillSuspend", ".");
|
||||||
SQAIController.DefSQStaticMethod(engine, &ScriptController::SetCommandDelay, "SetCommandDelay", 2, ".i");
|
SQAIController.DefSQStaticMethod(engine, &ScriptController::SetCommandDelay, "SetCommandDelay", ".i");
|
||||||
SQAIController.DefSQStaticMethod(engine, &ScriptController::Sleep, "Sleep", 2, ".i");
|
SQAIController.DefSQStaticMethod(engine, &ScriptController::Sleep, "Sleep", ".i");
|
||||||
SQAIController.DefSQStaticMethod(engine, &ScriptController::Break, "Break", 2, ".s");
|
SQAIController.DefSQStaticMethod(engine, &ScriptController::Break, "Break", ".s");
|
||||||
SQAIController.DefSQStaticMethod(engine, &ScriptController::GetSetting, "GetSetting", 2, ".s");
|
SQAIController.DefSQStaticMethod(engine, &ScriptController::GetSetting, "GetSetting", ".s");
|
||||||
SQAIController.DefSQStaticMethod(engine, &ScriptController::GetVersion, "GetVersion", 1, ".");
|
SQAIController.DefSQStaticMethod(engine, &ScriptController::GetVersion, "GetVersion", ".");
|
||||||
SQAIController.DefSQStaticMethod(engine, &ScriptController::Print, "Print", 3, ".bs");
|
SQAIController.DefSQStaticMethod(engine, &ScriptController::Print, "Print", ".bs");
|
||||||
|
|
||||||
SQAIController.PostRegister(engine);
|
SQAIController.PostRegister(engine);
|
||||||
|
|
||||||
/* Register the import statement to the global scope */
|
/* Register the import statement to the global scope */
|
||||||
SQAIController.DefSQStaticMethod(engine, &ScriptController::Import, "import", 4, ".ssi");
|
SQAIController.DefSQStaticMethod(engine, &ScriptController::Import, "import", ".ssi");
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,17 +14,17 @@ void SQGSController_Register(Squirrel *engine)
|
||||||
DefSQClass<ScriptController, ScriptType::GS> SQGSController("GSController");
|
DefSQClass<ScriptController, ScriptType::GS> SQGSController("GSController");
|
||||||
SQGSController.PreRegister(engine);
|
SQGSController.PreRegister(engine);
|
||||||
|
|
||||||
SQGSController.DefSQStaticMethod(engine, &ScriptController::GetTick, "GetTick", 1, ".");
|
SQGSController.DefSQStaticMethod(engine, &ScriptController::GetTick, "GetTick", ".");
|
||||||
SQGSController.DefSQStaticMethod(engine, &ScriptController::GetOpsTillSuspend, "GetOpsTillSuspend", 1, ".");
|
SQGSController.DefSQStaticMethod(engine, &ScriptController::GetOpsTillSuspend, "GetOpsTillSuspend", ".");
|
||||||
SQGSController.DefSQStaticMethod(engine, &ScriptController::SetCommandDelay, "SetCommandDelay", 2, ".i");
|
SQGSController.DefSQStaticMethod(engine, &ScriptController::SetCommandDelay, "SetCommandDelay", ".i");
|
||||||
SQGSController.DefSQStaticMethod(engine, &ScriptController::Sleep, "Sleep", 2, ".i");
|
SQGSController.DefSQStaticMethod(engine, &ScriptController::Sleep, "Sleep", ".i");
|
||||||
SQGSController.DefSQStaticMethod(engine, &ScriptController::Break, "Break", 2, ".s");
|
SQGSController.DefSQStaticMethod(engine, &ScriptController::Break, "Break", ".s");
|
||||||
SQGSController.DefSQStaticMethod(engine, &ScriptController::GetSetting, "GetSetting", 2, ".s");
|
SQGSController.DefSQStaticMethod(engine, &ScriptController::GetSetting, "GetSetting", ".s");
|
||||||
SQGSController.DefSQStaticMethod(engine, &ScriptController::GetVersion, "GetVersion", 1, ".");
|
SQGSController.DefSQStaticMethod(engine, &ScriptController::GetVersion, "GetVersion", ".");
|
||||||
SQGSController.DefSQStaticMethod(engine, &ScriptController::Print, "Print", 3, ".bs");
|
SQGSController.DefSQStaticMethod(engine, &ScriptController::Print, "Print", ".bs");
|
||||||
|
|
||||||
SQGSController.PostRegister(engine);
|
SQGSController.PostRegister(engine);
|
||||||
|
|
||||||
/* Register the import statement to the global scope */
|
/* Register the import statement to the global scope */
|
||||||
SQGSController.DefSQStaticMethod(engine, &ScriptController::Import, "import", 4, ".ssi");
|
SQGSController.DefSQStaticMethod(engine, &ScriptController::Import, "import", ".ssi");
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,7 @@ void Squirrel::PrintFunc(HSQUIRRELVM vm, const std::string &s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Squirrel::AddMethod(std::string_view method_name, SQFUNCTION proc, uint nparam, const char *params, void *userdata, int size)
|
void Squirrel::AddMethod(std::string_view method_name, SQFUNCTION proc, std::string_view params, void *userdata, int size)
|
||||||
{
|
{
|
||||||
ScriptAllocatorScope alloc_scope(this);
|
ScriptAllocatorScope alloc_scope(this);
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ void Squirrel::AddMethod(std::string_view method_name, SQFUNCTION proc, uint npa
|
||||||
}
|
}
|
||||||
|
|
||||||
sq_newclosure(this->vm, proc, size != 0 ? 1 : 0);
|
sq_newclosure(this->vm, proc, size != 0 ? 1 : 0);
|
||||||
if (nparam != 0) sq_setparamscheck(this->vm, nparam, params);
|
if (!params.empty()) sq_setparamscheck(this->vm, params.size(), params.data());
|
||||||
sq_setnativeclosurename(this->vm, -1, method_name);
|
sq_setnativeclosurename(this->vm, -1, method_name);
|
||||||
sq_newslot(this->vm, -3, SQFalse);
|
sq_newslot(this->vm, -3, SQFalse);
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ public:
|
||||||
* Adds a function to the stack. Depending on the current state this means
|
* Adds a function to the stack. Depending on the current state this means
|
||||||
* either a method or a global function.
|
* either a method or a global function.
|
||||||
*/
|
*/
|
||||||
void AddMethod(std::string_view method_name, SQFUNCTION proc, uint nparam = 0, const char *params = nullptr, void *userdata = nullptr, int size = 0);
|
void AddMethod(std::string_view method_name, SQFUNCTION proc, std::string_view params = {}, void *userdata = nullptr, int size = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a const to the stack. Depending on the current state this means
|
* Adds a const to the stack. Depending on the current state this means
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
void DefSQMethod(Squirrel *engine, Func function_proc, std::string_view function_name)
|
void DefSQMethod(Squirrel *engine, Func function_proc, std::string_view function_name)
|
||||||
{
|
{
|
||||||
using namespace SQConvert;
|
using namespace SQConvert;
|
||||||
engine->AddMethod(function_name, DefSQNonStaticCallback<CL, Func, ST>, 0, nullptr, &function_proc, sizeof(function_proc));
|
engine->AddMethod(function_name, DefSQNonStaticCallback<CL, Func, ST>, {}, &function_proc, sizeof(function_proc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,7 +43,7 @@ public:
|
||||||
void DefSQAdvancedMethod(Squirrel *engine, Func function_proc, std::string_view function_name)
|
void DefSQAdvancedMethod(Squirrel *engine, Func function_proc, std::string_view function_name)
|
||||||
{
|
{
|
||||||
using namespace SQConvert;
|
using namespace SQConvert;
|
||||||
engine->AddMethod(function_name, DefSQAdvancedNonStaticCallback<CL, Func, ST>, 0, nullptr, &function_proc, sizeof(function_proc));
|
engine->AddMethod(function_name, DefSQAdvancedNonStaticCallback<CL, Func, ST>, {}, &function_proc, sizeof(function_proc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,10 +53,10 @@ public:
|
||||||
* of the code, but without it calling your function will fail!
|
* of the code, but without it calling your function will fail!
|
||||||
*/
|
*/
|
||||||
template <typename Func>
|
template <typename Func>
|
||||||
void DefSQMethod(Squirrel *engine, Func function_proc, std::string_view function_name, int nparam, const char *params)
|
void DefSQMethod(Squirrel *engine, Func function_proc, std::string_view function_name, std::string_view params)
|
||||||
{
|
{
|
||||||
using namespace SQConvert;
|
using namespace SQConvert;
|
||||||
engine->AddMethod(function_name, DefSQNonStaticCallback<CL, Func, ST>, nparam, params, &function_proc, sizeof(function_proc));
|
engine->AddMethod(function_name, DefSQNonStaticCallback<CL, Func, ST>, params, &function_proc, sizeof(function_proc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,7 +66,7 @@ public:
|
||||||
void DefSQStaticMethod(Squirrel *engine, Func function_proc, std::string_view function_name)
|
void DefSQStaticMethod(Squirrel *engine, Func function_proc, std::string_view function_name)
|
||||||
{
|
{
|
||||||
using namespace SQConvert;
|
using namespace SQConvert;
|
||||||
engine->AddMethod(function_name, DefSQStaticCallback<CL, Func>, 0, nullptr, &function_proc, sizeof(function_proc));
|
engine->AddMethod(function_name, DefSQStaticCallback<CL, Func>, {}, &function_proc, sizeof(function_proc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,7 +76,7 @@ public:
|
||||||
void DefSQAdvancedStaticMethod(Squirrel *engine, Func function_proc, std::string_view function_name)
|
void DefSQAdvancedStaticMethod(Squirrel *engine, Func function_proc, std::string_view function_name)
|
||||||
{
|
{
|
||||||
using namespace SQConvert;
|
using namespace SQConvert;
|
||||||
engine->AddMethod(function_name, DefSQAdvancedStaticCallback<CL, Func>, 0, nullptr, &function_proc, sizeof(function_proc));
|
engine->AddMethod(function_name, DefSQAdvancedStaticCallback<CL, Func>, {}, &function_proc, sizeof(function_proc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,10 +86,10 @@ public:
|
||||||
* of the code, but without it calling your function will fail!
|
* of the code, but without it calling your function will fail!
|
||||||
*/
|
*/
|
||||||
template <typename Func>
|
template <typename Func>
|
||||||
void DefSQStaticMethod(Squirrel *engine, Func function_proc, std::string_view function_name, int nparam, const char *params)
|
void DefSQStaticMethod(Squirrel *engine, Func function_proc, std::string_view function_name, std::string_view params)
|
||||||
{
|
{
|
||||||
using namespace SQConvert;
|
using namespace SQConvert;
|
||||||
engine->AddMethod(function_name, DefSQStaticCallback<CL, Func>, nparam, params, &function_proc, sizeof(function_proc));
|
engine->AddMethod(function_name, DefSQStaticCallback<CL, Func>, params, &function_proc, sizeof(function_proc));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Var>
|
template <typename Var>
|
||||||
|
@ -109,16 +109,16 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Func, int Tnparam>
|
template <typename Func, int Tnparam>
|
||||||
void AddConstructor(Squirrel *engine, const char *params)
|
void AddConstructor(Squirrel *engine, std::string_view params)
|
||||||
{
|
{
|
||||||
using namespace SQConvert;
|
using namespace SQConvert;
|
||||||
engine->AddMethod("constructor", DefSQConstructorCallback<CL, Func, Tnparam>, Tnparam, params);
|
engine->AddMethod("constructor", DefSQConstructorCallback<CL, Func, Tnparam>, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddSQAdvancedConstructor(Squirrel *engine)
|
void AddSQAdvancedConstructor(Squirrel *engine)
|
||||||
{
|
{
|
||||||
using namespace SQConvert;
|
using namespace SQConvert;
|
||||||
engine->AddMethod("constructor", DefSQAdvancedConstructorCallback<CL>, 0, nullptr);
|
engine->AddMethod("constructor", DefSQAdvancedConstructorCallback<CL>);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostRegister(Squirrel *engine)
|
void PostRegister(Squirrel *engine)
|
||||||
|
|
|
@ -90,16 +90,16 @@ void squirrel_register_global_std(Squirrel *engine)
|
||||||
{
|
{
|
||||||
/* We don't use squirrel_helper here, as we want to register to the global
|
/* We don't use squirrel_helper here, as we want to register to the global
|
||||||
* scope and not to a class. */
|
* scope and not to a class. */
|
||||||
engine->AddMethod("require", &SquirrelStd::require, 2, ".s");
|
engine->AddMethod("require", &SquirrelStd::require, ".s");
|
||||||
engine->AddMethod("notifyallexceptions", &SquirrelStd::notifyallexceptions, 2, ".b");
|
engine->AddMethod("notifyallexceptions", &SquirrelStd::notifyallexceptions, ".b");
|
||||||
}
|
}
|
||||||
|
|
||||||
void squirrel_register_std(Squirrel *engine)
|
void squirrel_register_std(Squirrel *engine)
|
||||||
{
|
{
|
||||||
/* We don't use squirrel_helper here, as we want to register to the global
|
/* We don't use squirrel_helper here, as we want to register to the global
|
||||||
* scope and not to a class. */
|
* scope and not to a class. */
|
||||||
engine->AddMethod("min", &SquirrelStd::min, 3, ".ii");
|
engine->AddMethod("min", &SquirrelStd::min, ".ii");
|
||||||
engine->AddMethod("max", &SquirrelStd::max, 3, ".ii");
|
engine->AddMethod("max", &SquirrelStd::max, ".ii");
|
||||||
|
|
||||||
sqstd_register_mathlib(engine->GetVM());
|
sqstd_register_mathlib(engine->GetVM());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue