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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

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.