magicblock-labs / magicblock-labs/Solana.Unity-SDK
Runtime error: table index is out of bounds.
- Dominant language
- C#
- Stars
- 199
- Forks
- 128
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
After connecting wallet and request to mint, I'm getting " table index is out of bounds " and screen is not responding.

**Describe the solution you'd like**
- **Check the size of the table before accessing an index:** Before accessing an index in a table, always check that the index is less than the size of the table.
- **Use the ipairs function for iterating over tables:** The ipairs function in Lua is specifically designed for iterating over tables. It skips over any nil values and only iterates over the existing indices.
- **Use the pairs function for iterating over tables:** The pairs function in Lua iterates over all elements in the table, including nil values. If you're using pairs, make sure to check for nil values.
- **Check the size of the table after modifying it:** If you're modifying the table (adding or removing elements) during iteration, make sure to check the size of the table again after each modification.
Contributor guide
Research direction
Start by reproducing the wallet connection followed by the mint request, then capture the runtime stack trace to locate the table access involved. Done means the mint flow no longer raises the out-of-bounds error and the screen remains responsive.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, unity
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100