Jump to content




Printer.write - Variables don't work ?



2 replies to this topic

#1 Uberblockminer

  • Members
  • 10 posts

Posted 04 April 2014 - 05:11 PM

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 :)

#2 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 04 April 2014 - 05:35 PM

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.


#3 Uberblockminer

  • Members
  • 10 posts

Posted 04 April 2014 - 06:37 PM

 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 ...





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users