Announcement

Collapse
No announcement yet.

File Read/Write Alternatives

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • File Read/Write Alternatives

    Stumbled across a couple of nifty little functions which can be used in place of TextFile.ReadToString and TextFile.WriteFromString which I thought were pretty cool. I'll just leave 'em up here in case anyone's interested.

    Code:
    -- [B]Read from a text file[/B]
    local file = assert(io.open ("myfile.txt","r"))
    data = file:read("*a")
    file:close()
    
    [B]-- Write to a text file[/B]
    local file = assert(io.open ("myfile.txt","w"))
    file:write("Blah, blah")
    file:close()
    An example implemented in AMS is attached.

    Nb.
    Comes from here:
    Fun with Lua http://www.fredshack.com/docs/lua.html


    There's a bunch of interesting stuff, there.
    Attached Files

  • #2
    Just to clarify the above:

    File modes for io."x" methods are:




    And optional parameters include:





    Have fun!

    Comment


    • #3
      Very old news but thanks for posting as people that don't look in the old posts wont see it and nice way of how youposted the mods for people well done there
      Plugins or Sources MokoX
      BunnyHop 2021 Here

      Comment

      Working...
      X