This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Knovox's profile picture

Running program from code off my host?

Started by Knovox, 25 November 2017 - 03:05 AM
Knovox #1
Posted 25 November 2017 - 04:05 AM
Hello everybody.

I've been away from the CC community for a while but today I have decided to fiddle around with CC again. I was thinking that a good learning experience for me would be to try a fun project. My goal was to see if I could run code that is grabbed from my host. There is a file on my host that contains lua code. Everything is working fantastic, but then I approached a question… I want to be able to run that code without the file actually downloading to the computer, if that is possible. Simply creating a file and running it then deleting it works, but I want to make it as secure as possible, since anyone can just ctrl+r it and the file will still exist on the computer. I know pastebin has the option to just run a file but I can't figure it out.

My question is, how can I get the computer to run code passed to it from a file on my host, without saving it somehow to the computer?

I hope the question makes sense. Please feel free to ask anything else if it will help determine the answer. Thanks again!
Luca_S #2
Posted 25 November 2017 - 04:51 AM
Sounds like you are looking for loadstring:
https://www.lua.org/pil/8.html
KingofGamesYami #3
Posted 25 November 2017 - 04:52 AM
Have a read through this. I think you're looking for loadstring.

Edit: Ninja'd!
Edited on 25 November 2017 - 03:52 AM
Knovox #4
Posted 25 November 2017 - 08:15 PM
Sounds like you are looking for loadstring:
https://www.lua.org/pil/8.html
Have a read through this. I think you're looking for loadstring.

Edit: Ninja'd!

Thank you both! Just what I was looking for, and it works great.