Overkillz Posted July 14, 2016 Share Posted July 14, 2016 Hey dear community, Im just looking for a way if I can get a table with a lot of values to add it on an script I don't know if you understand me, then I will explain it better. -- TXT Files (test.txt) thisIsMyTable = {"value1","value2","value3","value4","value5"} otherTable = {"value1","value2","value3","value4","value5"} later I would like to load it on my script local variableScript = {} local otherVariableScript = {} function getTheVariables(table1,table2) if table1 then variableScript = table1 end if table2 then otherVariableScript = table2 end end Thanks for reading. Regards. Link to comment
Simple0x47 Posted July 14, 2016 Share Posted July 14, 2016 You could get the content of a .txt file with the io library. But I just don't get why you're trying to do it like that when there are more simplified ways to do it. Link to comment
Overkillz Posted July 14, 2016 Author Share Posted July 14, 2016 io library ? I have never heard about this, could you give me more details about it ? Thanks Link to comment
Captain Cody Posted July 14, 2016 Share Posted July 14, 2016 Well you can just rename the TXT file to a lua file and load it from there. Or use XML functions in the TXT file Link to comment
Moderators IIYAMA Posted July 14, 2016 Moderators Share Posted July 14, 2016 local myContent = { thisIsMyTable = {"value1","value2","value3","value4","value5"}, otherTable = {"value1","value2","value3","value4","value5"} } Read it and loadstring. As simple as that. Yet, why aren't you just use a lua file? And more important, what is the endresult? Or use only XML, which is in my opinion much more flexible and easy to use. Link to comment
Overkillz Posted July 14, 2016 Author Share Posted July 14, 2016 Yeah, I think im dumb today. Since I sleep few hours I couldn't get this on my mind haha. Thanks for it guys, Regards. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now