Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

GMLive.gml

Livecoding for GameMaker: Studio / GameMaker Studio 2 · By YellowAfterlife

[Fixed 1.0.48+] ds_map_keys_to_array optional argument and GMLive issue

A topic by Daikon Games created Feb 12, 2021 Views: 225 Replies: 2
Viewing posts 1 to 2
(1 edit)

Hello, the 2.3.1 function ds_map_keys_to_array has an issue in GMLive. The function takes an optional second argument of an array which it will append the ds_map's keys to, but if that is not provided the method will just return a new array containing the keys. The documentation states very clearly that the second argument is optional (in all caps even), however GMLive chokes if it is not provided:

[live][2/12/2021 6:09:07 PM] obj_shop_controller:Draw_64[L10,c18] `ds_map_keys_to_array` requires at least 2 arguments, got 1

I prefer to use that method in the one-argument form, but I cannot use GMLive on any script in which I've called it that way, which is a bit unfortunate. I don't know if this method was implemented in a different way than usual, or if any function with optional arguments would cause the same issue in GMLive

Developer(+1)

Documentation states one thing, but then fnames file has

ds_map_keys_to_array(id,array*,...)

instead of usual [argument] for optional arguments.

You can use live_function_add to override the function signature.

OK, that makes sense. Thanks for the workaround, I added this line earlier in execution and now it's happy:

live_function_add("ds_map_keys_to_array(id, ?array)", ds_map_keys_to_array);