ANtoine 0 Posted April 28, 2017 Share Posted April 28, 2017 Hello guys, I tried the print fuction and it works perfectly but it's boring to type every times the command : print3d /usr/share/models/... So I wanted to edit a program so I can just write what I need to print (netherportal/pillar_mid/...) local term = require("term") print("what do you want to print?") answer = io.read() -- Here I write the thing I want to print netherportal/pillar_mid/... os.execute("print3d /usr/share/models/,answer,.3dm) -- And I d'like to call it in that line but how, i don't know apparently it doesn't work so if you can help me, be fine and help me^^. Quote Link to post Share on other sites
2 Molinko 43 Posted April 28, 2017 Share Posted April 28, 2017 You are correct. I thought for some reason that was an example you inserted to say ...this model... The 'answer' var is a string returned from either term.read() or io.read() (excuse my first advice. term.read is probably better...). The line you're looking for is this.. os.execute("print3d /usr/share/models/" .. answer .. ".3dm") -- # string concatenation -- # OR os.execute(table.concat({"print3d ", "/usr/share/models/", answer, ".3dm"})) -- # Using table.concat({...}) Quote Link to post Share on other sites
0 Molinko 43 Posted April 28, 2017 Share Posted April 28, 2017 Replace require 'term' with 'io'. You don't use term lib but you are using the io lib. If that's not your issue please post the full code and resulting error please. Quote Link to post Share on other sites
0 ANtoine 0 Posted April 28, 2017 Author Share Posted April 28, 2017 I got the same error message I think the error is in the last line (.../,answer,...) because I tried it without knowing how to insert a variable into a program path. Quote Link to post Share on other sites
0 payonel 21 Posted June 27, 2017 Share Posted June 27, 2017 you don't need to require("io"), that is a global library you don't need to require("term") simply because you weren't using it Quote Link to post Share on other sites
Hello guys,
I tried the print fuction and it works perfectly but it's boring to type every times the command : print3d /usr/share/models/...
So I wanted to edit a program so I can just write what I need to print (netherportal/pillar_mid/...)
local term = require("term")
print("what do you want to print?")
answer = io.read() -- Here I write the thing I want to print netherportal/pillar_mid/...
os.execute("print3d /usr/share/models/,answer,.3dm) -- And I d'like to call it in that line but how, i don't know
apparently it doesn't work so if you can help me, be fine and help me^^.
Link to post
Share on other sites