Skip to content

Reuse enums - #1164

Open
arlocomotive wants to merge 3 commits into
Polytoria:mainfrom
arlocomotive:enum-fix
Open

Reuse enums#1164
arlocomotive wants to merge 3 commits into
Polytoria:mainfrom
arlocomotive:enum-fix

Conversation

@arlocomotive

Copy link
Copy Markdown
Contributor

Summary

reuses previously created enums instead of pushing a new one every time. makes all enum values identical internally, which notably allows them to be used as keys in tables. might also reduce memory usage a tiny bit idk

Related issue or discussion

Fixes #1162

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Tests
  • Build/export/tooling
  • Other

Area affected

  • Client
  • Creator
  • Server
  • Networking / replication
  • Scripting API
  • Scripting runtimes
  • Datamodel
  • UI / UX
  • Build / export
  • Other

Checklist

  • I have read the contributing guidelines
  • Added in-code documentation (where needed)
  • Ran dotnet restore
  • Ran dotnet format
  • Ran dotnet build
  • Ran dotnet test --project Polytoria.Tests/Polytoria.Tests.csproj
  • Tested the changes in a local environment
  • Ensured all commits are signed off

AI/LLM use

None

Signed-off-by: arlocomotive <arloyamins@gmail.com>
@arlocomotive
arlocomotive marked this pull request as ready for review August 23, 2026 02:46
@hiRemy

hiRemy commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

this pr adds a cross vm bug inside PushEnum </3

to reproduce, open two different world files in the creator and run the same script that touches enums, first world will work fine, the second one on the other hand will fail

@arlocomotive
arlocomotive marked this pull request as draft August 24, 2026 02:18
Signed-off-by: arlocomotive <arloyamins@gmail.com>
Signed-off-by: arlocomotive <arloyamins@gmail.com>
@arlocomotive

arlocomotive commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

this pr adds a cross vm bug inside PushEnum </3

to reproduce, open two different world files in the creator and run the same script that touches enums, first world will work fine, the second one on the other hand will fail

thought this might happen but didn't test enough 💔 turned the cache into a lua table in the registry, should work now

@arlocomotive
arlocomotive marked this pull request as ready for review August 24, 2026 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: enums from the api can't be used as table keys

2 participants