miguelferreira
Chieftain
- Joined
- Oct 26, 2014
- Messages
- 7
Hi,
I'm new to Civ modding and I wanted to have a good development cycle. One of the things I value the most is the ability to quickly see the state of execution, set breakpoints, watch expressions etc. As it currently stands I have to spam prints everywhere and even those prints need to be defensive.
There is a good debug client and server name MobDebug (https://github.com/pkulchenko/MobDebug) and I wondered if I could attach it to the game.
I have luasocket correctly installed and I am able to remotely debug any standalone lua file using mobdebug but for that I need to include it in the top of the file that I want to debug.
The thing is that require function is not available inside Civ's lua files, and even if I change all requires to includes, there are other global functions that are not available (Firaxis must be deleting them prior to loading the files I guess).
That leaves me without any kind of debugging power. I was wondering how do you guys deal with this? I can only imagine how hard and frustrating it must be to develop a complex mod using the current debugging capabilities.
And it is not just for debugging, without sockets there is no way to implement code hot swap, so every change requires at least 1 minute from the moment you write something to the moment you can finally test it.
Edit
I found this thread on Civ V: (http://forums.civfanatics.com/archive/index.php/t-487598.html) and it seems that my suspicions were true, _G is nil inside mods so you can't do anything outside of what Firaxis allows you to. Which not only makes it almost impossible to include any external library but it also makes it impossible to do even the simple things like creating a button to reload a given script.
I'm new to Civ modding and I wanted to have a good development cycle. One of the things I value the most is the ability to quickly see the state of execution, set breakpoints, watch expressions etc. As it currently stands I have to spam prints everywhere and even those prints need to be defensive.
There is a good debug client and server name MobDebug (https://github.com/pkulchenko/MobDebug) and I wondered if I could attach it to the game.
I have luasocket correctly installed and I am able to remotely debug any standalone lua file using mobdebug but for that I need to include it in the top of the file that I want to debug.
The thing is that require function is not available inside Civ's lua files, and even if I change all requires to includes, there are other global functions that are not available (Firaxis must be deleting them prior to loading the files I guess).
That leaves me without any kind of debugging power. I was wondering how do you guys deal with this? I can only imagine how hard and frustrating it must be to develop a complex mod using the current debugging capabilities.
And it is not just for debugging, without sockets there is no way to implement code hot swap, so every change requires at least 1 minute from the moment you write something to the moment you can finally test it.
Edit
I found this thread on Civ V: (http://forums.civfanatics.com/archive/index.php/t-487598.html) and it seems that my suspicions were true, _G is nil inside mods so you can't do anything outside of what Firaxis allows you to. Which not only makes it almost impossible to include any external library but it also makes it impossible to do even the simple things like creating a button to reload a given script.