MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / sq_setparamscheck

Function sq_setparamscheck

src/3rdparty/squirrel/squirrel/sqapi.cpp:388–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386}
387
388SQRESULT sq_setparamscheck(HSQUIRRELVM v,SQInteger nparamscheck,std::optional<std::string_view> typemask)
389{
390 SQObject o = stack_get(v, -1);
391 if(!sq_isnativeclosure(o))
392 return sq_throwerror(v, "native closure expected");
393 SQNativeClosure *nc = _nativeclosure(o);
394 nc->_nparamscheck = nparamscheck;
395 if(typemask.has_value()) {
396 SQIntVec res;
397 if(!CompileTypemask(res, *typemask))
398 return sq_throwerror(v, "invalid typemask");
399 nc->_typecheck.copy(res);
400 }
401 else {
402 nc->_typecheck.resize(0);
403 }
404 if(nparamscheck == SQ_MATCHTYPEMASKSTRING) {
405 nc->_nparamscheck = nc->_typecheck.size();
406 }
407 return SQ_OK;
408}
409
410SQRESULT sq_bindenv(HSQUIRRELVM v,SQInteger idx)
411{

Callers 3

sqstd_register_mathlibFunction · 0.85
sq_base_registerFunction · 0.85
AddMethodMethod · 0.85

Calls 5

sq_throwerrorFunction · 0.85
CompileTypemaskFunction · 0.85
copyMethod · 0.80
resizeMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected