diff --git a/bin/ai/compat_14.nut b/bin/ai/compat_14.nut index 5d47ffb8f3..586bf51c18 100644 --- a/bin/ai/compat_14.nut +++ b/bin/ai/compat_14.nut @@ -12,8 +12,8 @@ AIBridge.GetBridgeID <- AIBridge.GetBridgeType; class AICompat14 { function Text(text) { - if (typeof(text) != "string") return null; - return text; + if (type(text) == "string") return text; + return null; } } diff --git a/bin/game/compat_14.nut b/bin/game/compat_14.nut index c37eef2da4..49030e247a 100644 --- a/bin/game/compat_14.nut +++ b/bin/game/compat_14.nut @@ -12,9 +12,9 @@ GSBridge.GetBridgeID <- GSBridge.GetBridgeType; class GSCompat14 { function Text(text) { - type = typeof(text) - if (type != "string" && type != "GSText") return null; - return text; + if (type(text) == "string") return text; + if (type(text) == "instance" && text instanceof GSText) return text; + return null; } } diff --git a/cmake/scripts/SquirrelExport.cmake b/cmake/scripts/SquirrelExport.cmake index 9a12e74ed5..88f769b8d0 100644 --- a/cmake/scripts/SquirrelExport.cmake +++ b/cmake/scripts/SquirrelExport.cmake @@ -484,8 +484,9 @@ foreach(LINE IN LISTS SOURCE_LINES) string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.DefSQStaticMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\",${SPACES}${ARGC}, \"${TYPES}\");") endif() endforeach() - string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.DefSQAdvancedStaticMethod(engine, &PushClassName<${CLS}, ScriptType::${APIUC}>, \"_typeof\");") - string(APPEND SQUIRREL_EXPORT "\n") + if(MLEN) + string(APPEND SQUIRREL_EXPORT "\n") + endif() # Non-static methods set(MLEN 0) diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp index dee74ea9b8..6e36d0637f 100644 --- a/src/ai/ai_info.cpp +++ b/src/ai/ai_info.cpp @@ -35,7 +35,6 @@ template <> SQInteger PushClassName(HSQUIRRELVM vm) { sq DefSQClass SQAIInfo("AIInfo"); SQAIInfo.PreRegister(engine); SQAIInfo.AddConstructor(engine, "x"); - SQAIInfo.DefSQAdvancedStaticMethod(engine, &PushClassName, "_typeof"); SQAIInfo.DefSQAdvancedMethod(engine, &AIInfo::AddSetting, "AddSetting"); SQAIInfo.DefSQAdvancedMethod(engine, &AIInfo::AddLabels, "AddLabels"); SQAIInfo.DefSQConst(engine, SCRIPTCONFIG_NONE, "CONFIG_NONE"); diff --git a/src/game/game_info.cpp b/src/game/game_info.cpp index 0932077a8c..792e3a075e 100644 --- a/src/game/game_info.cpp +++ b/src/game/game_info.cpp @@ -33,7 +33,6 @@ template <> SQInteger PushClassName(HSQUIRRELVM vm) { DefSQClass SQGSInfo("GSInfo"); SQGSInfo.PreRegister(engine); SQGSInfo.AddConstructor(engine, "x"); - SQGSInfo.DefSQAdvancedStaticMethod(engine, &PushClassName, "_typeof"); SQGSInfo.DefSQAdvancedMethod(engine, &GameInfo::AddSetting, "AddSetting"); SQGSInfo.DefSQAdvancedMethod(engine, &GameInfo::AddLabels, "AddLabels"); SQGSInfo.DefSQConst(engine, SCRIPTCONFIG_NONE, "CONFIG_NONE"); diff --git a/src/script/api/ai/ai_controller.hpp.sq b/src/script/api/ai/ai_controller.hpp.sq index aea9e34aaa..c1363fb20b 100644 --- a/src/script/api/ai/ai_controller.hpp.sq +++ b/src/script/api/ai/ai_controller.hpp.sq @@ -14,8 +14,6 @@ void SQAIController_Register(Squirrel *engine) DefSQClass SQAIController("AIController"); SQAIController.PreRegister(engine); - SQAIController.DefSQAdvancedStaticMethod(engine, &PushClassName, "_typeof"); - SQAIController.DefSQStaticMethod(engine, &ScriptController::GetTick, "GetTick", 1, "."); SQAIController.DefSQStaticMethod(engine, &ScriptController::GetOpsTillSuspend, "GetOpsTillSuspend", 1, "."); SQAIController.DefSQStaticMethod(engine, &ScriptController::SetCommandDelay, "SetCommandDelay", 2, ".i"); diff --git a/src/script/api/game/game_controller.hpp.sq b/src/script/api/game/game_controller.hpp.sq index e8d1831dea..2ac9148426 100644 --- a/src/script/api/game/game_controller.hpp.sq +++ b/src/script/api/game/game_controller.hpp.sq @@ -14,8 +14,6 @@ void SQGSController_Register(Squirrel *engine) DefSQClass SQGSController("GSController"); SQGSController.PreRegister(engine); - SQGSController.DefSQAdvancedStaticMethod(engine, &PushClassName, "_typeof"); - SQGSController.DefSQStaticMethod(engine, &ScriptController::GetTick, "GetTick", 1, "."); SQGSController.DefSQStaticMethod(engine, &ScriptController::GetOpsTillSuspend, "GetOpsTillSuspend", 1, "."); SQGSController.DefSQStaticMethod(engine, &ScriptController::SetCommandDelay, "SetCommandDelay", 2, ".i");