|
EmilyRose Newbie
Joined: 09 Jul 2008 Posts: 8
|
Posted: Tue Sep 22, 2009 10:56 pm
Voter pkg for cmud - strange error |
Code: |
if not http then http = require("socket.http") end
print("Connecting to grab info...")
local page = http.request("http://www.topmudsites.com/vote-Sirene.html")
local vtid = string.match(page,'<input type="hidden" name="vtid1" value="(%x+)">')
local mudid = string.match(page,'<input type="hidden" name="mudid" value="(%d+)">')
print("Have info, voting now...")
local r, c = http.request("http://www.topmudsites.com/vote.php","vtid1=" .. vtid .. "&mudid=" .. mudid .. "&do=in")
if c == 301 then
print("Voting successful.")
else
print("Voting failed, error code " .. c)
end
|
Ok that's the code for the vote pkg I got this out of the CMUD library.
I installed the seperate LUA from here http://forums.zuggsoft.com/forums/viewtopic.php?t=32901
I'm not a coder of any sort, but it sort of worked until it gave me this error that I don't understand
Code: |
Error Parsing Command:
attempt to concatenate local 'vtid' (a nil value) (line 8)
Vote
Stack trace:
[String "code"]:8:in main chunk"
|
I have no idea what that means, I sent a bug report and Zugg said to post it here.
Anyone have any idea what it wants? :)
Thanks! |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Wed Sep 23, 2009 12:00 am |
It's happening because the vtid1 is no longer a field there. Instead, it's s09id1, so changing the vtid1 to s09id1 in both instances should work. No need to change the local vtid. That's just a variable. I could be wrong, though, but it seems to work.
Charneus |
|
|
|
EmilyRose Newbie
Joined: 09 Jul 2008 Posts: 8
|
Posted: Wed Sep 23, 2009 12:55 pm |
Code: |
if not http then http = require("socket.http") end
print("Connecting to grab info...")
local page = http.request("http://www.topmudsites.com/vote-Sirene.html")
local vtid = string.match(page,'<input type="hidden" name="vtid1" value="(%x+)">')
local mudid = string.match(page,'<input type="hidden" name="mudid" value="(%d+)">')
print("Have info, voting now...")
local r, c = http.request("http://www.topmudsites.com/vote.php","s09id1=" .. s09id1 .. "&mudid=" .. mudid .. "&do=in")
if c == 301 then
print("Voting successful.")
else
print("Voting failed, error code " .. c)
end |
Like that? Its producing the same stack trace error message |
|
|
|
EmilyRose Newbie
Joined: 09 Jul 2008 Posts: 8
|
Posted: Wed Sep 23, 2009 12:58 pm |
changed the local to s09id1 and now it works.
Thanks! |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Sep 28, 2009 1:44 am |
Thanks for this update; I've uploaded a new version of this script to the library that fixes the problem.
|
|
|
|
|
|