Odd errors in plugins

Posted by Shaun Biggs on Wed 22 Aug 2007 02:02 PM — 6 posts, 20,824 views.

USA #0
I have a few plugins for Aardwolf that I've started sharing out. So far they have worked pretty well for most people aside from needing a few workarounds for people who have blocked all os.* calls. There is one issue with one person trying to install them though. He recently upgraded from 3.65 to 4.14, and is having some odd problems I can't seem to track down.

[string "Plugin"]:109: unexpected symbol near `#' Line 121: Error parsing script (problem in this file)

  local qlength = GetInfo(304)
  qlength = math.floor( math.abs( qtime - qlength ) )
  gainstotal.quests = gainstotal.quests + 1
  gainstotal.qp = gainstotal.qp + gains.qp
  gainstotal.tp = gainstotal.tp + gains.tp
  gainstotal.train = gainstotal.train + gains.train
  gainstotal.prac = gainstotal.prac + gains.prac

  if #lastquests > 9 then
    for i = 1,9 do
      lastquests[i] = lastquests[i+1]
    end
    lastquests[ 10 ] = gains
  else
    table.insert( lastquests, gains )
  end
  local temp = GetInfo(304)
  lastquests[ #lastquests ].time = temp
  lastquests[ #lastquests ].length = qlength

Earlier in the script, lastquests is defined as an empty table, and I can't figure out why it doesn't give a nil value error if there's a problem with the variable's name. This works fine on my computer and a few others have tried it with no problem.

In another plugin, there is this error:
[string "Plugin"]:25: `)' expected near `%''
Line 48: Error parsing script (problem in this file)


--  Find total minutes it took to level
    local diff = math.floor( math.abs( newtime - oldtime ) )
--  Convert to days, hours, minutes, seconds
    local msg = GetVariable( "col2" )..string.format( "%02d", (diff % 60) )..GetVariable( "col3" ).."s"
    diff = math.floor( diff / 60 )
    msg = GetVariable( "col2" )..string.format( "%02d", (diff % 60) )..GetVariable( "col3" ).."m:"..msg

Again, it works on other computers. Any ideas on what could cause this?
Netherlands #1
I might be mistaken, but I thought the Lua version got upgraded from 5.0 to 5.1 somewhere inbetween those versions. Maybe the Lua interpreter dll didn't get updated correctly? I seem to recall that atleast the modulus operator got added in 5.1 (although I may very well be mistaken.)
USA #2
The newer versions of MUSHclient come with newer Lua dlls though. Would one somewhere else possibly override the one in the MC directory?
Netherlands #3
I don't know; I merely ment the installer may not have updated the dll (although it seems unlikely since it did that just fine for me). You could always look in system32 and whatever other standard searchpaths, though.
Australia Forum Administrator #4
It certainly sounds like they are still on Lua 5.0. I would get them to type this (assuming they have "/" as the script prefix):


/print (_VERSION) --> Lua 5.1


Also, this:


/print (Version ()) --> 4.14


MUSHclient is linked against lua5.1.dll, it is hard to see how they could still be using Lua 5.0 without a lot of mucking around and renaming files.

It seems more likely to me that, although they downloaded and installed MUSHclient 4.14, they are still using the earlier version (somehow).
USA #5
Thanks for the help. Somehow the guy was still using 3.65 after having installed 4.18.