Jump to content
The simFlight Network Forums
ark1320

CSV File String Variable Formatting in a Lua Script

Recommended Posts

Hi Pete,

I can't seem to find how to specify the formatting of string variables for a CSV file using, I assume, the newline \n character. I know how to do it with numerical variables, but am not having any luck with string variables.  For example, using something like

file:write(string.format("%-3s %-6s %-5s ", str_var1, \n str_var2, \n str_var3 \n ))

I want to end up with the value of each string variable on a separate line in the CSV file but can't seem to get the syntax correct.

Thanks for any suggestions,

Al

 

Share this post


Link to post
Share on other sites

The newlines go in the format string, so something like
    string.format("%-3s\n%-6s\n%-5s ", str_var1,  str_var2, str_var3)

Share this post


Link to post
Share on other sites
4 hours ago, John Dowson said:

The newlines go in the format string, so something like
    string.format("%-3s\n%-6s\n%-5s ", str_var1,  str_var2, str_var3)

Makes sense, thanks!

Al

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.