ComputerCraft Forums

ComputerCraft => Ask a Pro => Topic started by: CannotSleep on Mar 12, 2022, 12:10 AM

Title: What is this error and how to fix
Post by: CannotSleep on Mar 12, 2022, 12:10 AM
I hate to be the guy who asks "Why isn't my program working? Fix this for me", but I wrote what I thought would be a simple program and it's returning an error that I don't know what to do about. You can see my code here (https://pastebin.com/WSYqgZ3A).

All I'm trying to do is get the peripherals attached to a computer and list the methods.

When I run it, I get the error "list-peripheral-methods.lua:12: attempt to call local '(for generator)' (a table value)"

What does this error mean exactly? From what I can gather, lua doesn't like something about my for loop on line 12, but I can't for the life of me figure out what it is. Could someone please help me with this?
Title: What is this error and how to fix
Post by: CannotSleep on Mar 12, 2022, 12:19 AM
Never mind, I figured it out. For anyone else interested in knowing, the
for...in loop requires another parameter when iterating over anything other than the result of
pairs or
ipairs.