Thread Tools Display Modes
10-22-05, 05:10 PM   #1
nalmeth
A Defias Bandit
Join Date: Oct 2005
Posts: 3
Angry I/O question

Alright, I'm relatively new to WOW addons, but not to programming. I spent a few days and learned some lua. I've written a few small things just to get the hang of it. Now i'm working on a larger project and have come across a problem. I am trying to use the following

Code:
io.input("localpathtofile");
What happens is that when my addon loads up I call a function that has this line in it, but WOW barfs back an error. I have a Addmessage() line right before this that does display properly, but the one after the io line does not display at all. I thought possibly it was because the path must be relative to the Interface directory and I tried adjusting it, but that did not work either. Is this function allowed? Please help me out here. I've tried posting a few places with no response. (This mod has no dependencies).
  Reply With Quote
10-22-05, 09:57 PM   #2
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
It's intentionally not allowed. All file i/o is denied. The game goes to extreme lengths to prevent real-time information from going in or out of the game. As an example, when you /chatlog, instead of writing as new stuff is added, it holds your chat history session in game and won't even write it out on a /script ReloadUI(), it waits until you exit the game completely. There are loopholes still but they'll be closed off in time.

Your best best in saving information is SavedVariables.lua, or the chat logs. These can't update in realtime.
  Reply With Quote
10-23-05, 10:17 AM   #3
nalmeth
A Defias Bandit
Join Date: Oct 2005
Posts: 3
io

It's not that i'm using it for variable saving. I realize there's already a built-in method for that. I can also see why blizzard would disable any output, but why the input?

Basically I'm trying to parse a file that is generate by another program. My parser works fine using the lua interpreter, but errors on that function in wow. /sigh. So there's no work-arounds for this? (that are not against tos)
  Reply With Quote
10-24-05, 01:27 AM   #4
Gorak
A Fallenroot Satyr
Join Date: Oct 2005
Posts: 21
There's no way to read or write files from inside World of Warcraft. To store variables between gaming sessions, you use SavedVariables command in the TOC file.

This is a limitation we have to live with, and quite frankly, I am 100% happy that this feature is there. Looking at the flexibility available for add-ons, this doesn't seem to limit their creativeness or complexity. The sad fact is that you just have to do whatever it is you're trying to, in a different manner, without external programs.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » I/O question


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

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