Unofficial World of Warcraft Forums  
Please respect other members. Please do not post links or information about hacking/warez/cheats.
Read the rules of these forums as we rarely warn before banning. Lost or need RSS check the forum map.

Quick Site Nav
Navigation
Worldofwar.Net
WoW Forums
WoWDigger WoW Database
Articles
Community Blogs
WoW Info
Wrath of the Lich King Info
Primary Professions
Secondary Professions
Maps
Classes
PvP
A-Z Index
Guides
Submit Guides
List Guides
UI/Mods
Latest Mods
Submit Mod
List Macros
Submit Macro
Media Gallery
Gallery Home
Upload Pics
Community WoW Shots
Community BC Shots
Player Pics
Official WoW Shots
Official BC Shots


Donate and get extra forum perks
Support WoW:IncGamers

Go Back   Unofficial World of Warcraft Forums > WoW Community Forums > UI Customisation > UI/Mod Developer Forum

Reply
 
Thread Tools Display Modes
Old 01-06-2006, 09:05 AM   #1
bnelsonjax
WorldofWar.Net Member
 
Join Date: Apr 2006
Posts: 12
saved variables array

for the love of god i cant get saved variables to work correctly. what im trying to do is an array of player names in the savedvariables file.

in my .toc file i have:
## SavedVariables: QStatus, QPlayer

in my lua file in teh addons folder i have:
QPlayer[name] = {}

this thows up an error that says: attempt to index global `QPlayer' (a string value)

what am i doing wrong to make an array of names? is there any documentation that would help me?
bnelsonjax is offline   Reply With Quote
Old 01-06-2006, 04:29 PM   #2
Sherkhan
WorldofWar.Net Member
 
Join Date: Jul 2005
Location: Hillsboro, OR
Posts: 86
Try:

QPlayer = {} - Defines the array

Then
QPlayer[name] = {}
Sherkhan is offline   Reply With Quote
Old 02-06-2006, 07:45 AM   #3
bnelsonjax
WorldofWar.Net Member
 
Join Date: Apr 2006
Posts: 12
thanks, that worked. Now do you know how i would get it to list this way?


Code:
Raid = {
	[1] = {
		[JohnDoe] = 1123,
		[MikeJohns] = 1136,
	},
	[2] = {
		[Brad] = 0116,
		[Jim] = 0130,

the [1] = will be raid #1
the [2] will be raid #2
and those should be auto-incremented

[Johndoe] is obviously the Q_Player[name]

the =1123 is the current server time which im using:
timestamp = time();


any idea how to format it this way?

Last edited by bnelsonjax; 02-06-2006 at 07:48 AM..
bnelsonjax is offline   Reply With Quote
Old 02-06-2006, 08:52 AM   #4
bnelsonjax
WorldofWar.Net Member
 
Join Date: Apr 2006
Posts: 12
thanks, that worked. ok Now I have my variables listed to look like this:


Code:
Q_Player = {
	[1] = {
		["Bakstabb"] = true,
	},
	[2] = {
		["john doe"] = true,
	},
}

the [1] = will be the 1st player that whipsered me
the [2] = the 2nd player that whispered me


[Johndoe] is obviously the Q_Player[name]


so my question is what code would i use so that i could print out this list in my chat window to show:

[1] bakstabb
[2] john doe

so that it shows the chronologicall order of people that whipsered me?
im using: table.foreach(Q_Player, QMeUp_List) but its now working
bnelsonjax is offline   Reply With Quote
Old 02-06-2006, 07:22 PM   #5
include
WorldofWar.Net Member
 
include's Avatar
 
Join Date: Mar 2006
Posts: 62
hmm... why dont you just save it as
Q_Player = {
[1] = "bakstabb",
[2] = "jon doe",
}
include is offline   Reply With Quote
Old 03-06-2006, 12:34 AM   #6
bnelsonjax
WorldofWar.Net Member
 
Join Date: Apr 2006
Posts: 12
What the format to make it save like that?

and if i save it liek that how do i have it print back the results so it comes back:

1. bakstabb
2. john

bottom line is i need to record the order in which they whisper me which is why im saving the chronological numbers, and i need to be able to print the results with the correct order.
bnelsonjax is offline   Reply With Quote
Old 03-06-2006, 02:33 AM   #7
bnelsonjax
WorldofWar.Net Member
 
Join Date: Apr 2006
Posts: 12
ok i now have it formatting better. I have it looking like this:

Q_Player = {
[1] = "Doghunter",
[2] = "Bakstabb",
[3] = "brad",
}

however when i print it out, it only does this:

1
2
3


what should my code look like so when i send it to the DefaultChatFrame it would look like this:

1 Doghunter
2 Bakstabb
3 brad

thanks for the help.
bnelsonjax is offline   Reply With Quote
Sponsored Links
Old 03-06-2006, 08:28 PM   #8
BamED
WoW: IncGamers Member
 
Join Date: Oct 2005
Location: Denmark
Posts: 79
Code:
for i, name in ipairs(Q_Player) do
  DEFAULT_CHAT_FRAME:AddMessage(i .. " " .. name)
end
BamED is offline   Reply With Quote
Old 04-06-2006, 04:17 AM   #9
bnelsonjax
WorldofWar.Net Member
 
Join Date: Apr 2006
Posts: 12
yep that worked! thanks BamEd, now for a tough one.

How do i remove a name in the Q_Player table?
example if i type /qmu remove bakstabb what code would i use to have it remove the user bakstabb?

Thanks again for the help guys
bnelsonjax is offline   Reply With Quote
Old 04-06-2006, 06:17 AM   #10
BamED
WoW: IncGamers Member
 
Join Date: Oct 2005
Location: Denmark
Posts: 79
Code:
-- variable 'name' contains value to remove
local i = table.foreachi(Q_Player, function(i, v) if v==name then return i end end)
if i then 
  table.remove(Q_Player, i)
end
BamED is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:40 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Advertisement System V2.5 By   Branden