open-papyrus / papyrus-compiler

Open-source compiler for the Papyrus scripting language of Bethesda games.
https://open-papyrus.github.io/docs/papyrus-compiler/Introduction.html
MIT License
25 stars 3 forks source link

Create array with size determined at runtime #52

Open Scrabx3 opened 1 year ago

Scrabx3 commented 1 year ago

Being able to allocate arrays dynamically without relying on a script extender wrapper functions,

int i = 4
int[] a = new int[i]
erri120 commented 1 year ago

The op-code for array creation requires a constant size. This is a limitation imposed by the PEX format and can only be solved by very hacky solutions. I will leave this issue open for now, but this is not something that can easily be added by a compiler.