Closed FinnT730 closed 4 years ago
Rudimentary support for arrays are actually already implemented. Currently it's just int[]
arrays. (https://github.com/simon816/Command-Block-Assembly/blob/master/cbl/array_support.py)
I've been rewriting the type system and most of that finished yesterday so I hope to improve array support with the new design.
There is a basic Entity API, which allows getting and setting an entity's position - https://github.com/simon816/Command-Block-Assembly/blob/master/cbl/include/__builtin__#L94 More APIs will come as I get the fundamental features finished.
Thanks for the suggestions!
Hi,
I forgot something to ask, will you also make a example on how to use the array system?
Since, yes, I can create them, read them, but then when I do this: int test[1]; and then test[0] = 5;
It gives me errors. I don't know what is causing this, but I though that I would let you know about it.
I'd like to document all parts of CBL and Command IR. There's a lot to write about so I haven't got around to doing everything yet, just the grammar is documented.
Arrays have similar grammar to C/C++, an example:
int arr[10];
int n = 2;
int elem = arr[n];
arr[n] = elem * 2;
I just tried your array example, it should work, but it does appear to break on the old type system implementation. It works as expected on the latest commit (though my web demo is not updated yet). Thanks for letting me know though.
Ah yes... That might be the problem yes, I was using the web demo :p
Web demo has been updated to latest compiler version now.
Thanks!
Hello, So I wanna see some things that I think would be helpful to people.
Array support What I mean by that, is that we can store, and modify, and delete array values.
Get player data (like Motion, position or rotation) and safe it into a variable
For now this is all I could think of. Thank you for making such a amazing tool!, Keep up the good work.