Posted 26 February 2015 - 06:08 PM
I am trying to make a program that can print an ascii art logo then a message underneath e.g:
I have made it so that it prints correctly but I cant figure out how to run the program with a multiple word argument
So far I have:
And in another program:
This code works fine with no errors but only prints the first word of the message so it would print:
ASCIILOGO
Test message
I have made it so that it prints correctly but I cant figure out how to run the program with a multiple word argument
So far I have:
--Variables
local message = ...
local line = ""
local length = string.len(message)
local space = 0
local before = ""
--Calculate number of spaces before message to centre
if (length % 2 == 0) then
space = ((39 - length) / 2)
else space = (((39 - length) / 2) - 0.5
end
--Change a number of spaces into a string of that number of spaces
for x = 1, space, 1 do
before = before .. " "
end
*loads of print()s to print the logo*
print(before .. message)
And in another program:
shell.run("Logo","Test message")
This code works fine with no errors but only prints the first word of the message so it would print:
ASCIILOGO
Test