-
Notifications
You must be signed in to change notification settings - Fork 0
Ip config
Crafty-Codes edited this page May 6, 2023
·
2 revisions
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".
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
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:
local configEnv = {} -- 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 config
local f,err = loadfile("path/to/file", "t", configEnv) -- load the file
if f then
f() -- run the chunk
-- now configEnv should now contain our data
print(configEnv.network) -- table
else
print(err)
end