Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

[Fixed in 1.0.53+] Can't apply postfix to ds_list

A topic by Perichron Interactive created Jul 27, 2021 Views: 179 Replies: 1
Viewing posts 1 to 2
(1 edit)

The following syntax is valid GML:

var val = my_list[| my_index]++;

However, live-updating a script or event containing code of this form causes GMLive not to update the code and instead print the following error in the GM console, referencing the line where the code occurs:

Can't apply postfix to ds_list.

Both the code and GMLive are otherwise working fine-- all the right messages in the GMLive window, code returns expected values when tested with debug messages, etc. Error reproduces in a clean project.

Also seems to occur with other data structure types, e.g. ds_map, with corresponding error messages ("Can't apply postfix to ds_map").

Developer

This is fixed in 1.0.53+ - I previously gave up on prefix/postfix operators for accessors after the common ones ([], [@], [$]) since you need 4 different variations of generated code, each with its own unit tests to validate stack manipulation: So var val = my_list[| my_index]++; has to compile to

push my_list
push my_index
duplicate top 2 items on stack
call ds_list_find_value with top 2 items on stack, discard them, push result to stack
copy result (top item on stack) beyond top 3 items on stack
add 1 to the top item on stack
call ds_list_set with top 3 items on stack, discard them
pop earlier result from stack, store in local #i (val)