←  Ask a Pro

ComputerCraft | Programmable Computers for Minecraft

»

Printer.write - Variables don't work ?

Uberblockminer's Photo Uberblockminer 04 Apr 2014

Hello dudes and programmers


I need some help with my program, i made. It's a Cash Register, so i have to print a paper with price and etc.
But i can't print variables?

printer = peripheral.wrap("right")
printer.newPage()
printer.write("Hello i'm a printer", Variable)
printer.endPage()

When it prints, i only get "Hello i'm a printer" and not the variable...
I'm new at lua, but good at C#. That's why it's easy to learn new programming languages.

Please help :)
Quote

Cranium's Photo Cranium 04 Apr 2014

Moved to Ask A Pro.
Make sure you post questions in the correct section, so that you can get the most exposure.

As far as your question goes however, have you already defined the variable? Additionally, the comma is not how you concatenate variables in Lua. Use a double period, like this:
printer.write("Hello i'm a printer" .. Variable)

Edited by Cranium, 04 April 2014 - 05:36 PM.
Quote

Uberblockminer's Photo Uberblockminer 04 Apr 2014

 Cranium, on 04 April 2014 - 05:35 PM, said:

Moved to Ask A Pro.
Make sure you post questions in the correct section, so that you can get the most exposure.

As far as your question goes however, have you already defined the variable? Additionally, the comma is not how you concatenate variables in Lua. Use a double period, like this:
printer.write("Hello i'm a printer" .. Variable)

 Cranium, on 04 April 2014 - 05:35 PM, said:


Moved to Ask A Pro.
Make sure you post questions in the correct section, so that you can get the most exposure.

As far as your question goes however, have you already defined the variable? Additionally, the comma is not how you concatenate variables in Lua. Use a double period, like this:
printer.write("Hello i'm a printer" .. Variable)

 Cranium, on 04 April 2014 - 05:35 PM, said:


Moved to Ask A Pro.
Make sure you post questions in the correct section, so that you can get the most exposure.

As far as your question goes however, have you already defined the variable? Additionally, the comma is not how you concatenate variables in Lua. Use a double period, like this:
printer.write("Hello i'm a printer" .. Variable)
Ok!
Thx. I don't noticed the Ask A Pro Section because im new ...
Quote