87 posts
Posted 25 April 2012 - 03: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_testfor you to test on if you can do it let me no thanx :)/>/>
3 posts
Posted 25 April 2012 - 03:10 AM
I'm the mate :)/>/>
87 posts
Posted 25 April 2012 - 03:11 AM
I'm the mate :)/>/>
yes, yes you are
718 posts
Location
Hawaii
Posted 25 April 2012 - 03:16 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_testfor 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")
87 posts
Posted 25 April 2012 - 03:37 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_testfor 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
718 posts
Location
Hawaii
Posted 25 April 2012 - 03:43 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_testfor 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)
1111 posts
Location
Portland OR
Posted 25 April 2012 - 03: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.
87 posts
Posted 25 April 2012 - 04:20 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.
ok thanx
87 posts
Posted 25 April 2012 - 05:00 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.
ok i'm not sure now to use that :)/>/>
1111 posts
Location
Portland OR
Posted 25 April 2012 - 05: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.
496 posts
Location
New Zealand
Posted 25 April 2012 - 05: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()
87 posts
Posted 25 April 2012 - 05:16 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()
YAY thanx it worked
496 posts
Location
New Zealand
Posted 25 April 2012 - 05:17 AM
Glad I could help