Open tabularelf opened 4 days ago
Code in question used in project:
function print(value) {
show_debug_message(value);
return self;
}
var scope = {foo: "bar"};
var func = method(scope, print);
show_debug_message($"Direct method call: {func(42)}");
show_debug_message($"method_call: {method_call(func, [42])}");
show_debug_message($"script_execute: {script_execute(func, 42)}");
show_debug_message($"script_execute_ext: {script_execute_ext(func, [42])}");
From a short discussion on Discord, turns out that this was a fix from https://github.com/YoYoGames/GameMaker-Bugs/issues/1667. However, the manual still doesn't reflect those changes. https://manual.gamemaker.io/beta/en/GameMaker_Language/GML_Reference/Asset_Management/Scripts/script_execute.htm
(On a side note, that "second" use case is somewhat wrong? method_call
is more like script_execute_ext
.)
Listed method as a supported data type on the function reference pages, along with other changes. Also clarified the link between method_call()
and the script_execute*
functions and removed text in the manual that referred to script_execute*
as "legacy".
Description
On LTS (and LTSr3), trying to use
script_execute
orscript_execute_ext
would attempt to call a built in function (camera_create
). However at some point in Monthly and even on Beta, this behaviour was changed to get the method index but without the scope.You end up in a very strange situation where you're calling a method, but without the current scope. Resulting in a very strange scenario.
Method scopes are ignored, and the current
self
is used in place.Arguably, these should throw an exception for calling a method with
script_execute
orscript_execute_ext
as the script function.Steps To Reproduce
Which version of GameMaker are you reporting this issue for?
IDE v2024.1100.0.634 Runtime v2024.1100.0.658
Which operating system(s) are you seeing the problem on?
Windows 10.0.19045.0
Which platform(s) are you seeing the problem on?
Windows
8afd4ae2-7090-428a-b086-70f14eb09d00