In my opinion config.lua should be added to .gitignore. It's basic security rule not to add any configuration files to repo. Someone may accidentally push his config to repository...
It's not
I disagree, but we should rather ship it as config.lua.sample or other name that means it's just an example and should be modified, then add to .gitignore.
@ranisalt That's what I ment.
In tfs 0.x there was config.lua.dist as config.lua example. I don't know why it isn't done the same way in current version
I am also of the opinion
@PrinterLUA go ahead and PR :P
Wtf I don't know why I mentioned PrinterLUA. I meant @Dublerq but just saw now.
Why not simply add a dofile('../config.lua') at the add of the config file and overwrite settings like the database password, so even if you push your config by a mistake it won't be a huge one.
@Shawak because the default config.lua is meant to be read and modified. By forcing users to rename it they at least take note and we prevent any leaking of info anyway.
Why is config a lua file anyway, wouldn't it be simpler to parse it as xml, this would also simplify parsing it in the AAC's?
Sure it contains varying data types but that is what templates are for you could simply make a template struct map and store the data in there.
I know this works because I have constructed a parser in that same manner for other reasons.
Why is config a lua file anyway, wouldn't it be simpler to parse it as xml, this would also simplify parsing it in the AAC's?
Because you can use functions to define values. Lua is powerful as a programming language while XML is only for markup, crude values. Yet I never seen no one use it like that, you can e.g. have a function to apply double exp on weekends.
AACs ideally should not parse the Lua file, but rather communicate via the status protocol, that returns XML data.
Additionally, XML is uber ugly and IMHO we should replace everything with Lua.
You can still define functions in the same manner in lua even if the config file is in an xml format, these functions which call on the values from config are calling them from server not the config file directly and even if you think its ugly its still much simpler to do and frankly more organized.
No, not really. The Lua engine is called to run the config.lua file, so you can use any function available on the Lua core. With a little twist you can even do HTTP stuff on config.lua e.g. check icanhazip.com to set the IP automatically. It would not be possible with XML.
Yes, yes really, if this wasn't the case then we would not need ConfigManager when referencing something from config.lua, btw you are linking to a page which no longer exists.
xml is more user friendly when it comes to data manipulation, I've been writing scripts in lua for about 2 or 3 years, but never gave c++ a chance now I am seeing that we don't even need lua, if anything lua seems more like a burden on the server than a helpful extension of the server's functionality.
That is just my opinion, to each their own.
www.icanhazip.com
Lua is easy to learn and easy to use. The engine provides a safe environment so that a scripter doesn't need to know what is memory allocation, what's dangling pointer, what's free, what's what.
XML stands for EXtensible Markup Language. It's a Markup Language. Lua is a scripting language, that's the difference that makes it better to use Lua instead of XML. Ever heard of someone using XML for scripting? It's ok to use XML to represent data, but I don't see how it can prevail over Lua for script writing.
config.lua is in Lua because of how powerful Lua can be for configuration. As @ranisalt mentioned, you could automate lots of things with Lua with the simple addition of one variable = statement and statement or statement
I'd be suprised if you'd need ANY lua function to hardcode something in C++ written server. Lua scripting is much faster and the code is easy to reuse. That's why even advanced programmers (7y experience with OTS here) choose it over C++. I love seeing that you love newly learned C++ but still you need to learn which tool and when you should use complete your goals.
Well, if all you (want to) have is a hammer, then everything looks like a nail... Let's get back to the issue.
There is no need to discuss that topic here. That's not the point of github issues.
Please refrain from writing comments that don't contribute to solving the issue. I've deleted a few off-topic/offensive messages and blocked @Codex-NG from the repository.
I've shared my opinion about this issue here: https://github.com/otland/forgottenserver/pull/1888#issuecomment-242503897
@DSpeichert
This issue has been closed with commit 20df00b
Most helpful comment
Please refrain from writing comments that don't contribute to solving the issue. I've deleted a few off-topic/offensive messages and blocked @Codex-NG from the repository.
I've shared my opinion about this issue here: https://github.com/otland/forgottenserver/pull/1888#issuecomment-242503897