LUA Help (reading from/writing to files) menu

User Tag List

Results 1 to 3 of 3
  1. #1
    tagala's Avatar Private
    Reputation
    2
    Join Date
    Oct 2007
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LUA Help (reading from/writing to files)

    Is it possible to read from or write to a text file in LUA for private servers? if so, could i get an example?

    for example, i click on a gameobject and it opens up a gossipscript and i click something on it, and it makes a file called click.txt which says "tagal clicked a button!"
    Last edited by tagala; 10-03-2009 at 10:12 PM.

    These ads disappear when you log in.

  2. #2
    stoneharry's Avatar Moderator Harry


    Reputation
    1542
    Join Date
    Sep 2007
    Posts
    4,441
    Thanks G/R
    128/114
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    EvilMana.com - PSP Lua Tutorials - Reading And Writing Files

    Google's your best friend. I know this is for a psp, but it can easily be applied to WoW.

    Here is an example, a npc that saves to a text file what you write:
    Code:
    local current_comment = ""
    
    function Comment_Gossip(unit, event, player)
    unit:GossipCreateMenu(710, player, 0)
    unit:GossipMenuAddItem(0, "I would like to type something.", 1, 1)
    unit:GossipMenuAddItem(0, "Nevermind.", 2, 0)
    unit:GossipSendMenu(player)
    end
    
    function Comment_Select(unit, event, player, id, intid, Code)
    if Code ~= nil then
    comment(Code, Code)
    end
        if (intid == 2) then
        player:GossipComplete()
        end
    end
    
    
    function comment(codeid, txt)
    if txt == nil then
    return
    end
        if codeid == nil then
        return
        end
            local f = assert(io.open("server_comments.txt", "w"))
            current_comment = ""..current_comment.."\n\n"..codeid..""
            f:write(current_comment)
            f:close()
    end
    
    RegisterUnitGossipEvent(55555, 1, "Comment_Gossip")
    RegisterUnitGossipEvent(55555, 2, "Comment_Select")

  3. #3
    AngelSandy's Avatar Knight-Lieutenant
    Reputation
    19
    Join Date
    Jan 2009
    Posts
    330
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you explain that script a bit more in detail?
    It would be an interesting approach for bug reports on servers, so that people don't always have to post it on the forums. Unless the .txt file cannot be saved on the FTP server.

Similar Threads

  1. Replies: 2
    Last Post: 10-03-2011, 10:37 AM
  2. Need help reading Memory, Writing too memory
    By Neer in forum Programming
    Replies: 0
    Last Post: 08-17-2009, 12:11 PM
  3. Lua Help? Can't Write it? Start Here!
    By benzkool in forum WoW EMU General Releases
    Replies: 6
    Last Post: 12-18-2008, 03:28 PM
  4. [Help] vb6 Reading from a random file
    By Murdok in forum Programming
    Replies: 3
    Last Post: 10-20-2008, 12:39 PM
  5. Please read i need help(No help coming from the help section so)
    By getowned666 in forum WoW Scam Prevention
    Replies: 2
    Last Post: 08-17-2008, 10:58 PM
All times are GMT -5. The time now is 08:17 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search