Posted 10 November 2013 - 04:12 PM
Fixed - Thanks
Hi,Lately I've been working with immibis's Peripherals in a CMP (creative multiplayer) environment. I keep getting theAttempt to index ? (a function value)error when I attempt to call any of the mag-strip reader's functions (I have wrapped the reader in the reader variable on top of the computer). However, when I get a brand new computer, open the Lua interpreter, and type the same commands, it works fine.
Here is my code:
Spoiler
os.pullEvent = os.pullEventRawreader = peripheral.wrap
write = …
if write == "on" then
term.clear()
term.setCursorPos(1, 1)
print("Enter Card Data")
data = io.read()
term.clear()
term.setCursorPos(1, 1)
print("Enter Label")
label = io.read()
term.clear()
term.setCursorPos(1, 1)
print("Swipe Now")
reader.beginWrite(data, label)
else
term.clear()
term.setCursorPos(1, 1)
while true do
event, p1, p2, p3 = os.pullEvent("mag_swipe")
if p1 == "awsmazinggenius.35495604" then
print(textutils.formatTime(os.time(), false)..": A valid swipe was entered.")
rs.setOutput("left", true)
sleep(3)
rs.setOutput("left", false)
else
print(textutils.formatTime(os.time(), false)..": An invalid swipe was entered.")
reader.setInsertCardLight(true)
sleep(0.5)
reader.setInsertCardLight(false)
end
end
end
I get events when cards are swiped, but I get the errors whenever I call the reader functions, and only on this one computer. All my startup program does is run that program. Am I making a mistake, or am I the victim of a bug?
MC: 1.6.4
CC: 1.5.7
Immibis's Peripherals: Not sure but using the RazeCraft modpack. (Couldn't find a 1.6.4 version on the thread.)
Edited on 10 November 2013 - 03:43 PM