Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7883169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:27:45+00:00 2026-06-03T04:27:45+00:00

Right now I’m doing some tests but I cant seem to find what is

  • 0

Right now I’m doing some tests but I cant seem to find what is wrong with this code – any idea?

function IATetris(Pieza,Rotacion,Array)
io.write("The table the script received has: ",Pieza,"\n")
RotacionInicial = Rotacion
PosInicial = 7
final = #Array --this gets the size of the array
i = 1

    for y = 1, 20 do --the array of my tetris board is 20 in x and 14 in y so it would be something like this Array2D[20][14]

    io.write(" First for y ",y,"\n")
    Array2D[y]={} --clearing the new array
    for x = 1,14 do
    io.write(" First for x ",x,"\n")
        if i == final then break end

        io.write(" First for i",i,"\n")
        Array2D[y][x] = Array[i] 
        i= i+1 --seems like you cant use i++ in lua
        end
   end
end

What I’m doing is getting 2 integers and 1 Array. I’m having to write in the console to check where the program is actually going, and what I’m getting is…

The first log message: "The table the script received has: "

and the second log message: " First for y "

But I don’t get any further than those so probably the program is crashing there? This function is being called like every 20 seconds or so. I have really no idea why this is happening. Any help would be really appreciated, thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:27:46+00:00Added an answer on June 3, 2026 at 4:27 am

    If this line logs:

    io.write(" First for y ",y,"\n")
    

    and this line does not log:

    io.write(" First for x ",x,"\n")
    

    Then the problem is on one of these lines:

    Array2D[y]={} --clearing the new array
    for x = 1,14 do
    

    for x... definitely works for me, so I’d suggest it’s the Array2D line. There is nothing syntactically wrong with it, so it must be a runtime error. Runtime errors should be reported by Lua or the application it is embedded into. If they aren’t and the function just “stops” then you are debugging blind, and you will waste a lot of time on problems like this.

    The only error I can think might happen on that line would be if Array2D is not a table. Since you are trying to index it, it needs to be. Array2D isn’t declared in your function, this is fine if it is a global variable that is already defined elsewhere. However if it is meant to be a local variable just for this function then you should add local Array2D = {} to it.

    Without knowing what Array2D is, or what your actual error is even, it’s hard to give a more accurate answer. If you really have no better method of finding out the problem than logging, this, just before the Array2D line, should test my hypothesis:

    io.write("Array2D is: ", type(Array2D), "\n")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now, I've just some code which fetches the picture from the URL directly.
Right now I'm doing this: class MyTest(Base): __tablename__ = 'mytest' id = Column(Integer, primary_key
Right now I am writing some Python code to deal with massive twitter files.
Right now I'm doing something like this: RewriteRule ^/?logout(/)?$ logout.php RewriteRule ^/?config(/)?$ config.php I
Right now, I have code that looks something like this: Private Sub ShowReport(ByVal reportName
Right now, I am doing this in CoffeeScript: keys = (key for key of
Right now, I have: RewriteRule ^([^/\.]+)?$ index.php?id=$1 [L] to match any username at the
Right now when I run this it keeps clicking on the same button every
Right now, I have a domain entity named StyleBundle. This StyleBundle takes a list
right now i have this <script type='text/javascript'> $(#beau).click(function(){ $(#beau).animate({margin-Top: 738px}, fast); }); </script> and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.