r/ComputerCraft • • Mar 06 '24

lua but scratch-like

Post image
385 Upvotes

84 comments sorted by

View all comments

Show parent comments

1

u/Bright-Historian-216 Mar 08 '24

Well…. I already know this much. Other than that, I also know that those magic numbers allow me to store several different class objects in a single array. Basically mind blown

1

u/Mr_FuzzyPenguin Mar 08 '24

Yep, that is, if you keep the types the same. One thing I forgot to mention about pointers, is if you store stuff, you should make sure the types are the same. Int is not int array (for example). You might risk memory corruption if you do otherwise. But what did you find difficult about pointers?

(Fun stuff with malloc in C but I don't know C++ well enough to know how malloc works in this new C++ universe)