I’m not quite sure if this is a bug or not, but seeing as I can’t post in the bugs category I’ve elected to post here. If this is a bug, I ask that it be moved to the appropriate category.
Recently I was messing around with table.foreach for a game I was making when I stumbled across this error
Upon further testing, I found out that the cause of it was a yield in a function I was passing to table.foreach
Code:
If it is, in fact, a bug, this can be reproduced easily. Simply go into Studio and insert a LocalScript, copy/paste the code in the image and run a playtest. The fix itself is fairly easy, instead of using table.foreach you use a for loop like so:
Now obviously this isn’t a massive inconvenience, but I was wondering if anybody in the community knew why this error arose. Based on the error I’m assuming that the second argument in table.foreach is a C function (I can assume this because I don’t use any metamethods in the example provided), but why would this specific function be different from the rest of the library?
Any thoughts are appreciated!