DiSaMe Posted September 29, 2008 Share Posted September 29, 2008 When I do something like local sometable = {{}} then I can't do anything like sometable[2][2] = true . I get an error: attempt to index field '?' (a nil value). But if I define table in this way: local sometable = { {false,false} {false,false} } , then it's ok. But I need 32x32 table and I'm not going to copy & paste that much words. How to define table like that? Link to comment
robhol Posted September 29, 2008 Share Posted September 29, 2008 Looping is your friend. myTbl = {}; for x=1,32 do myTbl[x] = {}; for y=1,32 do myTbl[x][y] = false; end end Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now