Question: Save stuff to file and read the infomation?

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
ScriptKid
Posts: 4
Joined: Sun May 01, 2016 6:27 am

Question: Save stuff to file and read the infomation?

#1 Post by ScriptKid » Sun May 01, 2016 12:43 pm

Hey Guys i have a question
i Need to save informations from one micromacro to disk (like .ini files) to read out from another micromacro
a direct com with one to the other is not solving my request the data must be readable after restart from os or other reasons

have browse the wiki but not found something usefull Information

a short example for read/write data in style of .ini/hashtable is all i Need

hope you can help me
sorry for my bad english

User avatar
beanybabe
Posts: 646
Joined: Wed Mar 06, 2013 1:27 am

Re: Question: Save stuff to file and read the infomation?

#2 Post by beanybabe » Sun May 01, 2016 2:06 pm

you might look at this it is way to write some data.
viewtopic.php?f=27&t=6049&p=63935&hilit=log#p63935

User avatar
lisa
Posts: 8330
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Question: Save stuff to file and read the infomation?

#3 Post by lisa » Sun May 01, 2016 11:25 pm

well you have the file *****.lua and the info as a table.

inside the file would look like this

Code: Select all

return { "socks", "shoes", "hats"}
So the code to save it would be something like

Code: Select all

local file = io.open("filename.lua", "w")
file:write('return { "socks", "shoes", "hats"}')
file:close();
then you get the info from the file using include.

Code: Select all

tableinfo = {}
tableinfo  = include("filename.lua")
table.print(tableinfo)

That is the most basic way I can think of for what you said you wanted.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest