There is a solution to this, and it is very simple. In fact, I'm surprised so few people use it. Use an external .txt file to store the variables that you want the user to change.
Here's how:
1: In your mod folder, create a file called config.txt
2: Add this inside it:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
testvar = true
--Just a boolean value for fun
3: Add these lines in init.lua: (configpath var might be wrong, need to check)
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
configpath = minetest.get_mod_directory() ..'/config.txt'
dofile(configpath)
if testvar == true then
print("success")
end
And that is how to read lua from external text files!
Take a look at my ServerExtended mod to see this in action.