0

I made myself a drone os in the minecraft mod Opencomputers, but I want to be able to make it run any line of code once recieved from the network card. I've tried everything I found here but none of it works, or atleast I haven't done it the right way. Can someone give me an example of something that will run a string as code?

This is one of the things I've tried (message is a string)

os.execute(message)

Is there a way to convert the string to just, not a string so I can at least see if os.execute will work how i want it to?

  • 1
    It can be incredibly frustrating to try many different solutions and none of them work, but we still need to see at least one coding attempt you've made. Lua has a built-in function that does what you're asking for, but there are various reasons why it might not work, so it's very important that we see something you've tried. – luther Nov 20 '21 at 16:31
  • right, sorry forgot that – Gavinimations Nov 20 '21 at 16:42

1 Answers1

2

https://www.lua.org/manual/5.1/manual.html#pdf-loadstring

To load and run a given string, use the idiom

 assert(loadstring(s))()
Piglet
  • 27,501
  • 3
  • 20
  • 43