Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

global 'wait' is not callable (a nil value)

im newbie, and i cannot understand simple problem at my opinion,
my code is pretty simple and short, because i just trying to understand how’s lua working.

i = 1
repeat
    i = i + 1
    print (i)
    wait(0.5)
until i == 2000
print ("variable i, got value 2000, code has been stopped.")

the error is: global ‘wait’ is not callable (a nil value)

and i just cannot understand, how i need to call lua function "wait"

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

To explain the error message, any name that is not a local variable is considered global. All global variables are nil, unless we assign some other value to them. nil can’t be called like a function can.

Unfortunately, there is no wait function in Lua’s standard library. You can try to find something on luarocks.org that has it. If I understand what you’re trying to do, the function you want is usually called sleep.

Luarocks search

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading