generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: reading a text file in lua?

Previous Thread :: Next Thread 
pakez is not online. pakez
Joined: 17 Dec 2012
Total Posts: 11
25 Dec 2012 12:24 AM
say i have the following in a notepad.txt file:

apple
orange
banana

is it possible to read *.txt files and translate it into a table like this:

lines = {"apple", "orange", "banana"}

or is RBLX.lua just so limiting once again.
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
25 Dec 2012 12:32 AM
local lines = {}

for line in io.open("notepad.txt", "r"):lines() do
   table.insert(lines, line)
end

But the io library doesn't exist in Roblox.
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
25 Dec 2012 12:33 AM
because the users of a children's game should be able to access their friend's computer
Report Abuse
1waffle1 is not online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
25 Dec 2012 12:36 AM
It is possible to do what you asked.

1. Create .txt file with data
"apple
orange
bannana"
2. Create a RBX::Lua script
3. Read the .txt file and copy each line into the script formatted as a RBX::Lua table
4. ???
5. Profit
Report Abuse
pakez is not online. pakez
Joined: 17 Dec 2012
Total Posts: 11
25 Dec 2012 12:44 AM
im talking about reading a *.txt file in the same folder a plugin *.lua script is located in.

also waffle you are no help.
Report Abuse
1waffle1 is not online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
25 Dec 2012 01:17 AM
The os/io libraries do not EXIST in RBX::Lua. No matter what.
Report Abuse
SN0X is not online. SN0X
Joined: 24 Oct 2011
Total Posts: 7277
25 Dec 2012 04:25 AM
tehy pressed delete on the io file qq
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image