Nuke the CellId datatype (low priority trivia)

CellId is an unused non-functional datatype that was introduced into Roblox’s codebase around early 2011, when the original version of the Terrain feature was under development.

Its supposed to be constructed something like this:

CellId.new(isNil: boolean, x: number, y: number, z: number, terrainPart: Terrain?): CellId

When you try to use its constructor, it does not function as expected.
This happens because the Lua C API is not used correctly in the handler for the constructor.

Won’t dive too much into the details, but essentially it comes down to the calls using 0-based indexing instead of 1-based indexing to process the function arguments.

If you pass in 4 values, the xyz parameters are correctly aligned:

image

This seems to imply the first argument is processed as lua_toboolean(L, 0), so its trying to read the 0th value passed to the function. This is… evidently going to give incorrect results. The CellId.TerrainPart field is also never set, and always returns nil when accessing it.

My best guess is that this datatype was once intended to be used for querying terrain cells, and whether they were occupied or not (at the time, only the grass terrain cell existed!)

Overall, I think this datatype is worth nuking:

  • It has no documentation or uses in top games and usable code.
  • The old terrain engine has been gone for almost 3 years.
  • It isn’t (and never has been) used in any Roblox APIs.
  • It does not process arguments correctly.
34 Likes

I’d like to bump this thread as the datatype STILL exists, STILL doesnt have a utilization, and is STILL undocumented.

even the editor doesnt recognize it as a type (which is to be expected)
image

3 Likes

It’s unlikely they’re ever going to remove it unless it actually causes some kind of crash or exploit, since it’s ultimately harmless and extremely low priority.

I was antsy about this when Roblox was still autocompleting based on what was in the built-in variable environment (i.e. when CellId used to still be listed as an existing variable) but this is no longer the case.

3 Likes