mitchwadair / sidescroller-framework

A framework for CraftStudio (https://sparklinlabs.itch.io/craftstudio) to make creating 2D games simpler and easier
https://www.sframework.net
MIT License
0 stars 0 forks source link

fix bug in table.length #15

Closed mitchwadair closed 2 years ago

mitchwadair commented 2 years ago

Using table.length as an alias for table.getn only works for array tables. I need to support both. For efficiency, start by attempting to get length using #t, which will return 0 if not an array. In the case that #t is 0, perform the less efficient loop to calculate the length.