Skip to content

Lua: Standardize record stores

Zackhasacat requested to merge zackhasacat/openmw:lua_records_fix into master

Changes(nearly) all record stores to have its own table, containing "records"

This includes Factions, Magic effects, enchantments, spells, and sounds.

Also, changes addRecordFunctionBinding to allow indexing by refId, so that you can do types.Miscellaneous.records.gold_001, rendering record(id) useless. I would prefer if we could depreciate that function(leave it in the existing places, but remove the docs, and do not add it to new locations)

Docs updated here: https://openmw-zack.readthedocs.io/en/lua_records_fix/reference/lua-scripting/api.html

One thing that is missing is Cells. I think there needs to be a cellRecord object separate from the cell itself. Would it make sense to add types.Cell? Or change world.cells to return a list of cells records, that you could use to get the actual cell with world.getExteriorCell/world.getCellByName

The problem with how things currently are is first, lack of standardization. And second, it will be difficult to add functions(createRecordDraft) to create new records if there is no where to put them.

Edited by Zackhasacat

Merge request reports