Author Topic: How to change to 5.1  (Read 4023 times)

0 Members and 1 Guest are viewing this topic.

Offline DJ Bert

  • Triple Ace
  • **
  • Posts: 211
  • Karma: +6/-1
  • Guardian Scripter
How to change to 5.1
« on: 29 March, 2006, 23:42:44 »
What are all the things be changed for lua 5.1. Try to find some. I wil update Guardian to lua 5.1, but get some errors in section Tag in Description.

PtokaX forum

How to change to 5.1
« on: 29 March, 2006, 23:42:44 »

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 744
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
Re: How to change to 5.1
« Reply #1 on: 30 March, 2006, 00:02:14 »
Well, you should post the chunk and the error here in order to get help IMHO.
Everything could have been anything else and it would have just as much meaning.

Offline DJ Bert

  • Triple Ace
  • **
  • Posts: 211
  • Karma: +6/-1
  • Guardian Scripter
Re: How to change to 5.1
« Reply #2 on: 30 March, 2006, 00:46:38 »
Code: [Select]
--Description Tag by ??????Hawk?????? 27-02-2005 LUA 5

--===Sets the tag to be shown in reg's descriptions=================

regTagInDescription = "??????Reg??????" --\\ Tag

--==================================================================
--===Sets the tag to be shown in Vip's descriptions=================

VipTagInDescription = "??????Vip??????" --\\ Tag

--==================================================================
--===Sets the tag to be shown in op's descriptions==================

OpsTagInDescription = "??????Op??????" --\\ Tag

--==================================================================
--===Sets the tag to be shown in masters's descriptions=============

MastersTagInDescription = "??????Master??????" --\\ Tag

--==================================================================
--===Sets the time for the tags to be updated=======================

MastersTagInDescription = "??????Owner??????" --\\ Tag

--==================================================================

Mins = 1

--==================================================================



timer = 60000 * Mins
function Main()
SetTimer(timer)
StartTimer()
end

function OnTimer()
TagInDescription()
end

function TagInDescription()
local aux,usr
for aux, usr in GetUsersByProfile("vip") do
if (GetItemByName(usr) ~= nil) then
local userToShow = GetItemByName(usr)
if (userToShow.sMyInfoString ~= nil) then
local s,e,name,desc,speed,email,share = string.find(userToShow.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
SendToAll( "$MyINFO $ALL "..name.." "..VipTagInDescription.." "..desc.."$ $"..speed.."$"..email.."$"..share.."$")
end
end
end
for aux, usr in GetUsersByProfile("operator") do
if (GetItemByName(usr) ~= nil) then
local userToShow = GetItemByName(usr)
if (userToShow.sMyInfoString ~= nil) then
local s,e,name,desc,speed,email,share = string.find(userToShow.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
SendToAll( "$MyINFO $ALL "..name.." "..OpsTagInDescription.." "..desc.."$ $"..speed.."$"..email.."$"..share.."$")
end
end
end
for aux, usr in GetUsersByProfile("master") do
if (GetItemByName(usr) ~= nil) then
local userToShow = GetItemByName(usr)
if (userToShow.sMyInfoString ~= nil) then
local s,e,name,desc,speed,email,share = string.find(userToShow.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
SendToAll( "$MyINFO $ALL "..name.." "..MastersTagInDescription.." "..desc.."$ $"..speed.."$"..email.."$"..share.."$")
end
end
end
for aux, usr in GetUsersByProfile("reg") do
if (GetItemByName(usr) ~= nil) then
local userToShow = GetItemByName(usr)
if (userToShow.sMyInfoString ~= nil) then
local s,e,name,desc,speed,email,share = string.find(userToShow.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
SendToAll( "$MyINFO $ALL "..name.." "..regTagInDescription.." "..desc.."$ $"..speed.."$"..email.."$"..share.."$")
end
end
end
end


The error i get is in next line
Code: [Select]
for aux, usr in GetUsersByProfile("vip") do

attempt to call a table value

That is the same code what's is used in Guardian.
« Last Edit: 30 March, 2006, 00:52:22 by DJ Bert »

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 744
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
Re: How to change to 5.1
« Reply #3 on: 30 March, 2006, 00:52:37 »
Code: [Select]
for aux, usr in ipairs(GetUsersByProfile("vip")) do
Use ipairs for arrays, pairs for tables.
Everything could have been anything else and it would have just as much meaning.

Offline DJ Bert

  • Triple Ace
  • **
  • Posts: 211
  • Karma: +6/-1
  • Guardian Scripter
Re: How to change to 5.1
« Reply #4 on: 30 March, 2006, 00:57:51 »
Code: [Select]
for aux, usr in ipairs(GetUsersByProfile("vip")) do
Use ipairs for arrays, pairs for tables.

Oke, gonna try this,

Thnx bastya

PtokaX forum

Re: How to change to 5.1
« Reply #4 on: 30 March, 2006, 00:57:51 »