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

Method MethodExists

src/script/squirrel.cpp:323–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323bool Squirrel::MethodExists(HSQOBJECT instance, std::string_view method_name)
324{
325 assert(!this->crashed);
326 ScriptAllocatorScope alloc_scope(this);
327
328 int top = sq_gettop(this->vm);
329 /* Go to the instance-root */
330 sq_pushobject(this->vm, instance);
331 /* Find the function-name inside the script */
332 sq_pushstring(this->vm, method_name);
333 if (SQ_FAILED(sq_get(this->vm, -2))) {
334 sq_settop(this->vm, top);
335 return false;
336 }
337 sq_settop(this->vm, top);
338 return true;
339}
340
341bool Squirrel::Resume(int suspend)
342{

Callers 7

ConstructorMethod · 0.80
GameLoopMethod · 0.80
SaveMethod · 0.80
CallLoadMethod · 0.80
CheckMethodMethod · 0.80
ConstructorMethod · 0.80
ConstructorMethod · 0.80

Calls 5

sq_gettopFunction · 0.85
sq_pushobjectFunction · 0.85
sq_pushstringFunction · 0.85
sq_getFunction · 0.85
sq_settopFunction · 0.85

Tested by

no test coverage detected