Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
PcStack

How do I use a variable as a pastebin code?

Question

7 answers to this question

Recommended Posts

  • 0

I also need help doing it with a wireless modem message for a browser program...

and pastebin run here is my code;

component = require("component")
modem = component.modem
event = require("event")
print("Connent to which IP?")
ip = io.read("*n")
modem.open(ip)
modem.broadcast(ip, "packets")
local _, _, from, port, _, message = event.pull("modem_message")
message = tostring(i)
local command = table.concat({"pastebin run message"})
os.execute(command)

 

Link to post
Share on other sites
  • 0
  • Solution

You should use local variables to avoid future headache.

local component = require("component")
local modem = component.modem
local event = require("event")

print("Connent to which IP?")
local port = tonumber(io.read("*n")) -- # convert the string representation of a number to an actual number value
modem.open(port) -- # modem.open opens ports not IPs
modem.broadcast(port, "packets")
local message = select(5, event.pull("modem_message")) -- # get all event data after the 5th element/return value

os.execute("pastebin run " .. message)

 

Link to post
Share on other sites
  • 0
On 8/31/2018 at 7:30 PM, Molinko said:

You should use local variables to avoid future headache.


local component = require("component")
local modem = component.modem
local event = require("event")

print("Connent to which IP?")
local port = tonumber(io.read("*n")) -- # convert the string representation of a number to an actual number value
modem.open(port) -- # modem.open opens ports not IPs
modem.broadcast(port, "packets")
local message = select(5, event.pull("modem_message")) -- # get all event data after the 5th element/return value

os.execute("pastebin run " .. message)

Ik this but i will manipulate them to act like ips

thank you

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.