Using two-dimensional array instances in LUA

Source: Internet
Author: User
Tags arrays lua

This article mainly introduces the use of a two-dimensional array in Lua, this article directly gives a code example, to see the code easier to understand, the need for friends can refer to the

As with JS in Lua, there is no concept of two-dimensional arrays, but two-dimensional arrays are extremely important to our development and, of course, are used a lot. Talk about using two-dimensional arrays in Lua?

Principle, a one-dimensional array gives a nested is a two-dimensional array, OK, so simple, look at the code easier to understand

Recently doing a project, the following is part of the code

?

1 2 3 4 5 6 7 8 For i=1,10 does self.startmartix[i]={} self.star[i]={} for j=1,10 do self.startmartix[i][j]= starsprite Star_ End

This creates the Self.startmartix, the Self.star is all the two-dimensional array appearance, the visit time, Self.star[1][1] can

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.