diff options
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/gd_functions.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/gd_script.cpp | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp index c099c3f33c..f789493ae8 100644 --- a/modules/gdscript/gd_functions.cpp +++ b/modules/gdscript/gd_functions.cpp @@ -1095,7 +1095,7 @@ MethodInfo GDFunctions::get_info(Function p_func) { return mi; } break; case MATH_RAND: { - MethodInfo mi("rand"); + MethodInfo mi("randi"); mi.return_val.type=Variant::INT; return mi; } break; diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 29857e6be6..75bb47ceab 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -635,6 +635,19 @@ Variant GDFunction::call(GDInstance *p_instance,const Variant **p_args, int p_ar err.argument-=1; } } + } if (methodstr=="free") { + + if (err.error==Variant::CallError::CALL_ERROR_INVALID_METHOD) { + + if (base->is_ref()) { + err_text="Attempted to free a reference."; + break; + } else if (base->get_type()==Variant::OBJECT) { + + err_text="Attempted to free a locked object (calling or emitting)."; + break; + } + } } err_text=_get_call_error(err,"function '"+methodstr+"' in base '"+basestr+"'",(const Variant**)argptrs); break; |