lotrointerface.com
Search Downloads


Go Back   LoTROInterface > LotRO > Developer Discussions > Lua Programming Help (L)

Reply
Thread Tools Display Modes
  #1  
Unread 11-17-2011, 12:33 PM
nuna nuna is offline
The Wary
 
Join Date: Nov 2011
Posts: 1
Unhappy I'm having troubles with text output in my code with lua :(

Hello i'm having troubles with text output when I search file for &A "Non letter characters" how come my ObjectOuput.txt doesn't output it?

Code:
require "lfs"
 
 
 
 
input = io.open("ObjectOutput.txt","w")
 
 
filename = ".obj"
 
pattern = "\.obj$"
 
for dir_elem in lfs.dir("test folder") do
        local target = "test folder" .. "/" .. dir_elem
        if lfs.attributes(target).mode == "file" then
 
                if string.match(filename,pattern) then
 
                        local file = io.open(target, "r")
 
 
 
                                for match in file:lines("%v") do
 
 
 
                                input:write(" test ")
 
 
 
end
 
 
 
                                        for match in file:lines("%A") do
 
 
                                        input:write(" ",match)
end
 
 
 
 
 
 
--END LINE
end
 
end
end
Reply With Quote
  #2  
Unread 11-17-2011, 12:55 PM
Equendil Equendil is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Apr 2011
Posts: 52
Not tried myself, but the io.* library is supposed to be disabled.

Edit: not sure either the "dofile" and "require" statements (or other module statements for that matter) are enabled, Turbine came up with "import" that runs the given lua script if it hasn't been run already by another "import" statement, within an environment set to be equal to the 'path' of the script.

In other words, "import a.b.c" will run "Plugins/a/b/c.lua" with _G.a.b set as its environment.
__________________
Author of LIP, Bootstrap and Baruk

Last edited by Equendil : 11-17-2011 at 01:12 PM.
Reply With Quote
  #3  
Unread 11-17-2011, 02:13 PM
lunarwtr's Avatar
lunarwtr lunarwtr is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Feb 2011
Posts: 121
Quote:
Originally Posted by nuna
Hello i'm having troubles with text output when I search file for &A "Non letter characters" how come my ObjectOuput.txt doesn't output it?
Try adding the "b" mode operator when opening the file handle as you are writing out binary data.
__________________
Author of Lotro Compendium, Waypoint, and Lotro Plugin Compendium (LPC)
Reply With Quote
Reply


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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Where exactly do you install Turbines Standard Code? Lethians Interface Help (L) 2 07-01-2011 01:30 PM
help on color code please Eili Script & Skin Managers 2 02-08-2011 12:47 PM
Dressing Room Troubles Cithryth Interface Help (L) 3 06-02-2010 10:15 AM
Probelm with code wackafoo XML modification help (L) 0 05-27-2010 01:35 AM
Bottom Left UI Code Cleitanious XML modification help (L) 8 04-30-2008 05:47 AM


All times are GMT -5. The time now is 05:12 AM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui