Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ##############################
- -- msg_receiver test4
- rednet.open("right")
- function hevo()
- print("hevohevo!")
- end
- while true do
- local sender_id, message, distance = rednet.receive()
- local func = loadstring(message)
- setfenv(func, getfenv()) -- change func's environment(_G) to current one.
- local status, err = pcall(func)
- if status then -- success
- print("#",sender_id,": ",message)
- else -- wrong string
- print("(error) #",sender_id,": ",message)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement