LoTROInterface

LoTROInterface (https://www.lotrointerface.com/forums/index.php)
-   Lua Programming Help (L) (https://www.lotrointerface.com/forums/forumdisplay.php?f=50)
-   -   I'm having troubles with text output in my code with lua :( (https://www.lotrointerface.com/forums/showthread.php?t=1687)

nuna 11-17-2011 12:33 PM

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


Equendil 11-17-2011 12:55 PM

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.

lunarwtr 11-17-2011 02:13 PM

Quote:

Originally Posted by nuna (Post 7394)
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.


All times are GMT -5. The time now is 06:37 PM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI