<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: passing command line params to lua script. in Netfabb Forum</title>
    <link>https://forums.autodesk.com/t5/netfabb-forum/passing-command-line-params-to-lua-script/m-p/8846837#M2246</link>
    <description>&lt;P&gt;Hello Steffen,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The parameters I want to pass to the lua are decided dynamically, so they can not be read from a config file from inside the lua.&lt;/P&gt;&lt;P&gt;so since the parameters are not allowed, I need to do a very very dirty workaround.&lt;BR /&gt;1. create a template lua script (with a special character sequence where the parameters will be replaced)&lt;/P&gt;&lt;P&gt;2. Create a copy of the template script in %temp% folder&lt;/P&gt;&lt;P&gt;3. replace the special char sequence in the lua with param string&lt;/P&gt;&lt;P&gt;4. run the script in net fabb&lt;/P&gt;&lt;P&gt;5. delete after use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Repeat above steps whenever needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope you provide capability of passing parameters in future releases. &lt;img id="smileyfrustrated" class="emoticon emoticon-smileyfrustrated" src="https://forums.autodesk.com/i/smilies/16x16_smiley-frustrated.png" alt="Smiley Frustrated" title="Smiley Frustrated" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2019 11:39:47 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-06-12T11:39:47Z</dc:date>
    <item>
      <title>passing command line params to lua script.</title>
      <link>https://forums.autodesk.com/t5/netfabb-forum/passing-command-line-params-to-lua-script/m-p/8846212#M2244</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am running a lua script on Netfabb startup using following method&lt;/P&gt;&lt;P&gt;&lt;U&gt;C:\Program Files\Autodesk\Netfabb Ultimate 2020\netfabb.exe&amp;nbsp;/startluascript="D:\MyLuaScript.lua"&amp;nbsp;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;I want to pass a parameter to MyLuaScript.lua, like&lt;/P&gt;&lt;P&gt;C:\Program Files\Autodesk\Netfabb Ultimate 2020\netfabb.exe&amp;nbsp;/startluascript="D:\MyLuaScript.lua" &lt;FONT color="#0000FF"&gt;"param1" "param2"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Is it possible to send the custom command line arguments (i.e. param1, param2) and access them in MyLuaScript.lua during its execution?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Thanks.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 05:12:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/netfabb-forum/passing-command-line-params-to-lua-script/m-p/8846212#M2244</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-12T05:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: passing command line params to lua script.</title>
      <link>https://forums.autodesk.com/t5/netfabb-forum/passing-command-line-params-to-lua-script/m-p/8846665#M2245</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No, this is currently not supported. However, in the script you're calling, you could hard-code reading from a configuration file which you would auto-generate similar to how you would auto-generate the command-line you want to use for calling Netfabb.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Steffen&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 09:38:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/netfabb-forum/passing-command-line-params-to-lua-script/m-p/8846665#M2245</guid>
      <dc:creator>steffen_anders_adsk</dc:creator>
      <dc:date>2019-06-12T09:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: passing command line params to lua script.</title>
      <link>https://forums.autodesk.com/t5/netfabb-forum/passing-command-line-params-to-lua-script/m-p/8846837#M2246</link>
      <description>&lt;P&gt;Hello Steffen,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The parameters I want to pass to the lua are decided dynamically, so they can not be read from a config file from inside the lua.&lt;/P&gt;&lt;P&gt;so since the parameters are not allowed, I need to do a very very dirty workaround.&lt;BR /&gt;1. create a template lua script (with a special character sequence where the parameters will be replaced)&lt;/P&gt;&lt;P&gt;2. Create a copy of the template script in %temp% folder&lt;/P&gt;&lt;P&gt;3. replace the special char sequence in the lua with param string&lt;/P&gt;&lt;P&gt;4. run the script in net fabb&lt;/P&gt;&lt;P&gt;5. delete after use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Repeat above steps whenever needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope you provide capability of passing parameters in future releases. &lt;img id="smileyfrustrated" class="emoticon emoticon-smileyfrustrated" src="https://forums.autodesk.com/i/smilies/16x16_smiley-frustrated.png" alt="Smiley Frustrated" title="Smiley Frustrated" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 11:39:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/netfabb-forum/passing-command-line-params-to-lua-script/m-p/8846837#M2246</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-12T11:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: passing command line params to lua script.</title>
      <link>https://forums.autodesk.com/t5/netfabb-forum/passing-command-line-params-to-lua-script/m-p/8846893#M2247</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remember that you can read files not only of plaintext but also of JSON and XML. These formats are accessible very conveniently through objects, making reading and also writing very streamlined. Instead of replacing string sequences in an actual Lua script, you could auto-generate a new configuration file from your dynamic parameters every time you wish to run the actual Lua script. This would be more robust to debug and to maintain.&lt;/P&gt;
&lt;P&gt;An example of reading a configuration of sorts during runtime from a JSON file is realised in the NAS scripts in the Examples folder, NAS standing for Netfabb Application Service.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Steffen&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 12:52:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/netfabb-forum/passing-command-line-params-to-lua-script/m-p/8846893#M2247</guid>
      <dc:creator>steffen_anders_adsk</dc:creator>
      <dc:date>2019-06-12T12:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: passing command line params to lua script.</title>
      <link>https://forums.autodesk.com/t5/netfabb-forum/passing-command-line-params-to-lua-script/m-p/8847201#M2248</link>
      <description>&lt;P&gt;&amp;gt;&amp;nbsp;&lt;SPAN&gt;Instead of replacing string sequences in an actual Lua script, you could auto-generate a new configuration file from your dynamic parameters every time you wish to run the actual Lua script. This would be more robust to debug and to maintain.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Agreed,&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, creating a json file at run time and accessing it in the lua isn't an elegant way either, especially if I want to access only a couple of parameters.&lt;/P&gt;&lt;P&gt;Command line params to the lua script would be the best way.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 13:50:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/netfabb-forum/passing-command-line-params-to-lua-script/m-p/8847201#M2248</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-12T13:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: passing command line params to lua script.</title>
      <link>https://forums.autodesk.com/t5/netfabb-forum/passing-command-line-params-to-lua-script/m-p/8851581#M2249</link>
      <description>&lt;P&gt;No, it would not be the best way, not least for technical reasons:&lt;/P&gt;
&lt;P&gt;Those command-line parameters you're requesting would be parameters not so much for the Lua script (or the Lua interpreter in Netfabb) but to Netfabb itself for which &lt;CODE&gt;/startluascript&lt;/CODE&gt; is already a command-line parameter in its own right. Provisioning for yet more parameters that may or may not be relevant to the&amp;nbsp;&lt;EM&gt;netfabb.exe&lt;/EM&gt;&amp;nbsp;executable would defeat the purpose as to why Lua was made available in Netfabb in the first place, automation and realizing user-individual functionality without having to wait for the next Netfabb release, among other things.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And besides, there is really not much difference between (hypothetical example, does not work, and will not be implemented)&lt;/P&gt;
&lt;PRE&gt;REM launchNF.cmd:
start "" "C:\Program Files\Autodesk\Netfabb Ultimate 2020\netfabb.exe" ^
    /startluascript="path\to\startupscript.lua" %1 %2
&lt;/PRE&gt;
&lt;PRE&gt;-- startupscript.lua:
parameter1 = arg[0]
parameter2 = arg[1]
&lt;/PRE&gt;
&lt;P&gt;and (this does work in the Netfabb you already have, ready to go)&lt;/P&gt;
&lt;PRE&gt;REM launchNF.cmd:
echo {"parameter1":"%1","parameter2":"%2"} &amp;gt; startupparameters.json
start "" "C:\Program Files\Autodesk\Netfabb Ultimate 2020\netfabb.exe" ^
    /startluascript="path\to\startupscript.lua"
&lt;/PRE&gt;
&lt;PRE&gt;-- startupscript.lua:
paramJ = system:loadjson("path\\to\\startupparameters.json")
parameter1 = paramJ:getstring("parameter1")
parameter2 = paramJ:getstring("parameter2")
&lt;/PRE&gt;
&lt;P&gt;so that you could use&lt;/P&gt;
&lt;PRE&gt;launchNF.cmd Alice Bob&lt;/PRE&gt;
&lt;P&gt;to launch the whole thing in either case.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2025 08:45:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/netfabb-forum/passing-command-line-params-to-lua-script/m-p/8851581#M2249</guid>
      <dc:creator>steffen_anders_adsk</dc:creator>
      <dc:date>2025-10-23T08:45:14Z</dc:date>
    </item>
  </channel>
</rss>

