OpenDreamProject / OpenDream

A project for running games made in the DM programming language
MIT License
200 stars 109 forks source link

LHS of a list index is being evaluated before the RHS #1865

Open wixoaGit opened 3 months ago

wixoaGit commented 3 months ago
var/list/L = list(null, null)
var/depth = 1

L[depth-1] = ++depth

world.log << json_encode(L)

This should give [2,null] but instead crashes in OD because it evaluates to L[0] = 2 instead of L[1] = 2. ++depth should execute before depth-1.