forked from mirrors/0ad
Enable latest JS language features.
Load GUI scripts as UTF-8. This was SVN commit r7650.
This commit is contained in:
@@ -91,6 +91,12 @@ public:
|
||||
template<typename T0, typename T1>
|
||||
bool CallFunctionVoid(jsval val, const char* name, const T0& a0, const T1& a1);
|
||||
|
||||
/**
|
||||
* Call the named property on the given object, with void return type and 3 arguments
|
||||
*/
|
||||
template<typename T0, typename T1, typename T2>
|
||||
bool CallFunctionVoid(jsval val, const char* name, const T0& a0, const T1& a1, const T2& a2);
|
||||
|
||||
/**
|
||||
* Call the named property on the given object, with return type R and 0 arguments
|
||||
*/
|
||||
@@ -145,6 +151,8 @@ public:
|
||||
|
||||
template<typename T, typename CHAR> bool Eval(const CHAR* code, T& out);
|
||||
|
||||
std::wstring ToString(jsval obj);
|
||||
|
||||
/**
|
||||
* Report the given error message through the JS error reporting mechanism,
|
||||
* and throw a JS exception. (Callers can check IsPendingException, and must
|
||||
@@ -275,6 +283,18 @@ bool ScriptInterface::CallFunctionVoid(jsval val, const char* name, const T0& a0
|
||||
return CallFunction_(val, name, argv, jsRet);
|
||||
}
|
||||
|
||||
template<typename T0, typename T1, typename T2>
|
||||
bool ScriptInterface::CallFunctionVoid(jsval val, const char* name, const T0& a0, const T1& a1, const T2& a2)
|
||||
{
|
||||
LOCAL_ROOT_SCOPE;
|
||||
jsval jsRet;
|
||||
std::vector<jsval> argv;
|
||||
argv.push_back(ToJSVal(GetContext(), a0));
|
||||
argv.push_back(ToJSVal(GetContext(), a1));
|
||||
argv.push_back(ToJSVal(GetContext(), a2));
|
||||
return CallFunction_(val, name, argv, jsRet);
|
||||
}
|
||||
|
||||
template<typename T0, typename R>
|
||||
bool ScriptInterface::CallFunction(jsval val, const char* name, const T0& a0, R& ret)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user