Add: support for std::string parameters in the script API
This commit is contained in:
@@ -91,6 +91,20 @@ namespace SQConvert {
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct Param<const std::string &> {
|
||||
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 <typename Titem>
|
||||
struct Param<Array<Titem>> {
|
||||
static inline Array<Titem> Get(HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
|
||||
|
Reference in New Issue
Block a user