At the moment a friend and I are working on a project to make things in our guild run smoother. The plan is to write an addon to handle a list in-game. We'd like to pull data from the website into a textfile and then convert the textfile to an lua file after it's downloaded. However, the issue we've run into now is if someone saves the textfile to their computer (as intended) we lose part of the formatting (the returns). This wouldn't be an issue, but lua formatting is going to require that the first line be separated from the rest. When viewed in the browser the textfile appears to be formatted fine, but when downloaded all the returns vanish. Is there another way I could be writing this where the returns will stay when downloaded?
This should yield in lua format:
but we end up with all the returns removed :/
Last edited by Aredon on Sun Nov 23, 2008 1:11 am; edited 1 time in total
| Code: |
| $list="prioritylist.txt";
$fh=fopen($list, 'w') or die("can't open file"); $stringData="local HALootManager = HALootManager; \nHALootManager.PriorityList = { Mains = {\n"; // START MAIN CHARACTERS fwrite($fh, $stringData); $maincounter=1; while($maincounter<=10){ $stringData="[".$maincounter."]=\"Charname\",\n"; fwrite($fh, $stringData); $maincounter=$maincounter+1; } $stringData="}, PrimaryAlts = {\n"; fwrite($fh, $stringData); // END MAIN CHARACTERS, START PRIMARY ALTS $pacounter=1; while($pacounter<=10){ $stringData="[".$pacounter."]=\"Charname\",\n"; fwrite($fh, $stringData); $pacounter=$pacounter+1; } $stringData="}, Alts = {\n"; fwrite($fh, $stringData); // END PRIMARY ALTS, START ALTS $altcounter=1; while($altcounter<=10){ $stringData="[".$altcounter."]=\"Charname\",\n"; fwrite($fh, $stringData); $altcounter=$altcounter+1; } $stringData="},\n}"; fwrite($fh, $stringData); // END ALTS, END FILE fclose($fh); |
This should yield in lua format:
| Code: |
|
local HALootManager = HALootManager; HALootManager.PriorityList = { Mains = { [1]="Charname", [2]="Charname", [3]="Charname", [4]="Charname", [5]="Charname", [6]="Charname", [7]="Charname", [8]="Charname", [9]="Charname", [10]="Charname", }, PrimaryAlts = { [1]="Charname", [2]="Charname", [3]="Charname", [4]="Charname", [5]="Charname", [6]="Charname", [7]="Charname", [8]="Charname", [9]="Charname", [10]="Charname", }, Alts = { [1]="Charname", [2]="Charname", [3]="Charname", [4]="Charname", [5]="Charname", [6]="Charname", [7]="Charname", [8]="Charname", [9]="Charname", [10]="Charname", }, } |
but we end up with all the returns removed :/
Last edited by Aredon on Sun Nov 23, 2008 1:11 am; edited 1 time in total
