-
Posted by zidencjb on Wed, 25 Aug 2010 04:16:00
Hi
I have a question about Lua and how I can save the information in SavedVariables folder.
I have an addon call "qwerty" with the next Cmd... "/qwe", when I type /qwe it show me a message, in that point everything is ok.
Now my question is... how i can save my information?
for example if I write /qwe Hello world , how i can save that message in the folder SavedVariables/qwerty.lua?
savedvariables/qwerty.lua
QWERTYDB = { ["message"] = { ["msg1"] = "Hello World", } }
and if I write an other message... "/qwe My second msg"
savedvariables/qwerty.lua
QWERTYDB = { ["message"] = { ["msg1"] = "Hello World", ["msg2"] = "My second msg", } }
thanks for the help and sorry about my english.
PD: I read in WoWwiki about "saving variable", but i try it and i get "Addon incompatible"
ty for help ^^
-
Posted by jnwhiteh on Wed, 25 Aug 2010 08:25:50
I have an addon call "qwerty" with the next Cmd... "/qwe", when I type /qwe it show me a message, in that point everything is ok.
Now my question is... how i can save my information?
for example if I write /qwe Hello world , how i can save that message in the folder SavedVariables/qwerty.lua?
This is covered in the 'Anatomy of an Addon' chapter. You use the #SavedVariables directive in the table of contents file to indicate which global variables should be saved at the end of a session. You then need to alter your code to not fully initialize until the
ADDON_LOADED
event with your addon's name as the first argument, since this indicates that your saved variables are loaded.PD: I read in WoWwiki about "saving variable", but i try it and i get "Addon incompatible"
More information can be found in Chapter 8 of the second edition.
-
Posted by zidencjb on Wed, 25 Aug 2010 19:54:45
Ty!
I try with
qwerty.toc
## Interface: 30000 ## Title: QWERTY ## SavedVariables: Qwerty ## SavedVariablesPerCharacter: QwertyMSG qwerty.lua
qwerty.lua
local frame = CreateFrame("FRAME"); frame:RegisterEvent("ADDON_LOADED"); function frame:OnEvent(event, arg1) if event == "ADDON_LOADED" and arg1 == "qwerty" then Qwerty = "MESSAGE"; end end frame:SetScript("OnEvent", frame.OnEvent); SLASH_QWERTY = "/qw"; function SlashCmdList.QWERTY(msg) print("Hello World"); end
And this working good...
How i can do that when i log... in the qwerty.lua ALWAYS save a msg difference?
For example... now only save:
Qwerty = "MESSAGE"
I need save ALWAYS i log, the same MESSAGE...
example... if i log 10 times to day in the qwerty.lua i see
Qwerty = "MESSAGE" Qwerty = "MESSAGE" Qwerty = "MESSAGE" Qwerty = "MESSAGE" Qwerty = "MESSAGE" Qwerty = "MESSAGE" Qwerty = "MESSAGE" Qwerty = "MESSAGE" Qwerty = "MESSAGE" Qwerty = "MESSAGE"
Or also
Qwerty = { ["MESSAGE1"] = "MESSAGE", ["MESSAGE2"] = "MESSAGE", ["MESSAGE3"] = "MESSAGE", ["MESSAGE4"] = "MESSAGE", ["MESSAGE5"] = "MESSAGE", ["MESSAGE6"] = "MESSAGE", ["MESSAGE7"] = "MESSAGE", ["MESSAGE8"] = "MESSAGE", ["MESSAGE9"] = "MESSAGE", ["MESSAGE10"] = "MESSAGE", }
Ty :)
-
Posted by jnwhiteh on Wed, 25 Aug 2010 20:53:08
In ANOTHER addon... with another MESSAGE, this saving the information too in qwerty.lua.bak?
or i need another function ?
No. You can make Querty a table instead of a string to save multiple things inside the table. But I don't understand why you'd have a second addon altering the first addon's saved data, but you could do that if you wanted to.
-
Posted by zidencjb on Wed, 25 Aug 2010 21:25:17
I edited my last message
No. You can make Querty a table instead of a string to save multiple things inside the table. But I don't understand why you'd have a second addon altering the first addon's saved data, but you could do that if you wanted to.
Oh. I understand it. ^^
This I am trying to do. I have two addons (EasyEmail and QuickAuction3 (With Auctionner)). I created a website on my local server to control my "Post" in the AH and the money received.
Currently I just copy and paste this information from the chat (With Prat) and my PHP programming with JS, takes the information that I copy and save it in the DDBB (Mysql).
So, I want to save this information in a. Lua with a addon. Then upload it .lua and collect the information automatically. And I'm pretty noob with Lua, I only know web programming. =/
If u can help me or orient ... I'll be very grateful
-
Posted by jnwhiteh on Thu, 26 Aug 2010 08:48:25
I edited my last message
Please don't. I respond too quickly for that.
No. You can make Querty a table instead of a string to save multiple things inside the table. But I don't understand why you'd have a second addon altering the first addon's saved data, but you could do that if you wanted to.
Oh. I understand it. ^^
This I am trying to do. I have two addons (EasyEmail and QuickAuction3 (With Auctionner)). I created a website on my local server to control my "Post" in the AH and the money received.
Currently I just copy and paste this information from the chat (With Prat) and my PHP programming with JS, takes the information that I copy and save it in the DDBB (Mysql).
So, I want to save this information in a. Lua with a addon. Then upload it .lua and collect the information automatically. And I'm pretty noob with Lua, I only know web programming. =/
If u can help me or orient ... I'll be very grateful
I can't write your addon for you, and I wrote three books about writing addons for World of Warcraft. As I've said a few times, this stuff is already covered in the book, in a few different places. I'm sorry I can't be of more help, but I don't really have time to provide support outside the books.
-
Posted by zidencjb on Fri, 27 Aug 2010 09:16:54
I can't write your addon for you, and I wrote three books about writing addons for World of Warcraft. As I've said a few times, this stuff is already covered in the book, in a few different places. I'm sorry I can't be of more help, but I don't really have time to provide support outside the books.
No, I do not want you to write the code ^ ^ guidance only. And I know your books, but my English is very bad and do not understand all, so I prefer to seek guidance and manuals in Spanish.
But, reading too much and looking online, I do that I wanted