Jump to content




Website code runner? [HELP NEEDED]


12 replies to this topic

#1 rex41043

  • Members
  • 88 posts

Posted 25 April 2012 - 02:06 AM

I was working on a website program (CODE BELOW) then my m8 asked me if I can get it to run code not just show text and i was not sure so ya
Text website code:
-- printing the text
shell.run("clear")
local tmpF = http.get("http://computercraft.nuclear-games.net63.net/Icubeos/websites/Icube_site")
local text = tmpF:readAll()
print( text )

I tryed to make it so it wood run code like shell.run("clear")
if it has it in the file i have made a file at the url: http://computercraft...sites/code_test
for you to test on if you can do it let me no thanx :)/>

#2 abthouse29

  • New Members
  • 4 posts

Posted 25 April 2012 - 02:10 AM

I'm the mate :)/>

#3 rex41043

  • Members
  • 88 posts

Posted 25 April 2012 - 02:11 AM

 abthouse29, on 25 April 2012 - 02:10 AM, said:

I'm the mate :)/>
yes, yes you are

#4 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 25 April 2012 - 02:16 AM

 rex41043, on 25 April 2012 - 02:06 AM, said:

I was working on a website program (CODE BELOW) then my m8 asked me if I can get it to run code not just show text and i was not sure so ya
Text website code:
-- printing the text
shell.run("clear")
local tmpF = http.get("http://computercraft.nuclear-games.net63.net/Icubeos/websites/Icube_site")
local text = tmpF:readAll()
print( text )

I tryed to make it so it wood run code like shell.run("clear")
if it has it in the file i have made a file at the url: http://computercraft...sites/code_test
for you to test on if you can do it let me no thanx :)/>

Try
file = fs.open("test", "r")
file.write(text)
file:close()
shell.run("test")


#5 rex41043

  • Members
  • 88 posts

Posted 25 April 2012 - 02:37 AM

 ComputerCraftFan11, on 25 April 2012 - 02:16 AM, said:

 rex41043, on 25 April 2012 - 02:06 AM, said:

I was working on a website program (CODE BELOW) then my m8 asked me if I can get it to run code not just show text and i was not sure so ya
Text website code:
-- printing the text
shell.run("clear")
local tmpF = http.get("http://computercraft.nuclear-games.net63.net/Icubeos/websites/Icube_site")
local text = tmpF:readAll()
print( text )

I tryed to make it so it wood run code like shell.run("clear")
if it has it in the file i have made a file at the url: http://computercraft...sites/code_test
for you to test on if you can do it let me no thanx :)/>

Try
file = fs.open("test", "r")
file.write(text)
file:close()
shell.run("test")
but I want it as a temp file at the most

#6 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 25 April 2012 - 02:43 AM

 ComputerCraftFan11, on 25 April 2012 - 02:16 AM, said:

 rex41043, on 25 April 2012 - 02:06 AM, said:

I was working on a website program (CODE BELOW) then my m8 asked me if I can get it to run code not just show text and i was not sure so ya
Text website code:
-- printing the text
shell.run("clear")
local tmpF = http.get("http://computercraft.nuclear-games.net63.net/Icubeos/websites/Icube_site")
local text = tmpF:readAll()
print( text )

I tryed to make it so it wood run code like shell.run("clear")
if it has it in the file i have made a file at the url: http://computercraft...sites/code_test
for you to test on if you can do it let me no thanx :)/>

Try
local file1 = "test"

file = fs.open(file1, "r")
file.write(text)
file:close()
shell.run(file1)
fs.delete(file1)


#7 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 25 April 2012 - 02:59 AM

There is the io.tmpfile() command which you could play with that should make a temp file for you and also delete it when the program is closed.

#8 rex41043

  • Members
  • 88 posts

Posted 25 April 2012 - 03:20 AM

 luanub, on 25 April 2012 - 02:59 AM, said:

There is the io.tmpfile() command which you could play with that should make a temp file for you and also delete it when the program is closed.
ok thanx

#9 rex41043

  • Members
  • 88 posts

Posted 25 April 2012 - 04:00 AM

 luanub, on 25 April 2012 - 02:59 AM, said:

There is the io.tmpfile() command which you could play with that should make a temp file for you and also delete it when the program is closed.
ok i'm not sure now to use that :)/>

#10 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 25 April 2012 - 04:05 AM

I have not used it either, only know its there. When i get home tonight I'll play with it and try to get you an example if someone else doesn't beat me to it.

#11 Xtansia

  • Members
  • 492 posts
  • LocationNew Zealand

Posted 25 April 2012 - 04:10 AM

Try Load string
local tmpF = http.get("[url="http://computercraft.nuclear-games.net63.net/Icubeos/websites/code_test"]http://computercraft.nuclear-games.net63.net/Icubeos/websites/code_test[/url]")
local code = tmpF:readAll()
tmpF:close()

local codeFunc = loadstring(code)
setfenv(codeFunc, getfenv())
codeFunc()


#12 rex41043

  • Members
  • 88 posts

Posted 25 April 2012 - 04:16 AM

 tomass1996, on 25 April 2012 - 04:10 AM, said:

Try Load string
local tmpF = http.get("[url="http://computercraft.nuclear-games.net63.net/Icubeos/websites/code_test"]http://computercraft.nuclear-games.net63.net/Icubeos/websites/code_test[/url]")
local code = tmpF:readAll()
tmpF:close()

local codeFunc = loadstring(code)
setfenv(codeFunc, getfenv())
codeFunc()
YAY thanx it worked

#13 Xtansia

  • Members
  • 492 posts
  • LocationNew Zealand

Posted 25 April 2012 - 04:17 AM

Glad I could help





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users