diff --git a/cmake/scripts/SquirrelExport.cmake b/cmake/scripts/SquirrelExport.cmake index 6fc6f094e6..76fbdd68ab 100644 --- a/cmake/scripts/SquirrelExport.cmake +++ b/cmake/scripts/SquirrelExport.cmake @@ -631,6 +631,8 @@ foreach(LINE IN LISTS SOURCE_LINES) string(APPEND TYPES "a") elseif("${PARAM}" MATCHES "^Text") string(APPEND TYPES ".") + elseif("${PARAM}" MATCHES "^std::string") + string(APPEND TYPES ".") else() string(APPEND TYPES "x") endif() diff --git a/src/script/squirrel_helper.hpp b/src/script/squirrel_helper.hpp index 02b584fe49..ed220b8b40 100644 --- a/src/script/squirrel_helper.hpp +++ b/src/script/squirrel_helper.hpp @@ -91,6 +91,20 @@ namespace SQConvert { } }; + template <> struct Param { + static inline const std::string Get(HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) + { + /* Convert what-ever there is as parameter to a string */ + sq_tostring(vm, index); + + const SQChar *tmp; + sq_getstring(vm, -1, &tmp); + std::string result = StrMakeValid(tmp); + sq_poptop(vm); + return result; + } + }; + template struct Param> { static inline Array Get(HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)