You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Crafty-Codes edited this page May 6, 2023
·
2 revisions
Creation
The Ip config file will be created at startup. The creator is under /boot/95_network.lua. It will create the file /etc/network/interface. The folder in /etc will be created automatically.
This tool overwrites the config at boot.
If you want to regenerate it delete the folder "/etc/network".
Config file
The config file is in a standard lua format.
network= {
interface="eth0",
ip="10.0.0.10",
}
As we can see there are two key's. The first is the Internet card and the second is the ip address
Reading
As previously said, this is a standard lua config format and is so easy to parse into lua.
Here is a demonstration code of how to do it:
localconfigEnv= {} -- Create a variable in which it will be stored-- Here we are loading the file with the path, the mode "t" (Only text chunks.) and out variable in which we will load the configlocalf,err=loadfile("path/to/file", "t", configEnv) -- load the fileiffthenf() -- run the chunk-- now configEnv should now contain our dataprint(configEnv.network) -- tableelseprint(err)
end