Skip to content

Instantly share code, notes, and snippets.

@NelsonMinar
Created February 5, 2013 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NelsonMinar/4716882 to your computer and use it in GitHub Desktop.
Save NelsonMinar/4716882 to your computer and use it in GitHub Desktop.
Run an arbitrary URL as Lua code in ComputerCraft (Minecraft)
-- Execute a URL as Lua code in ComputerCraft
-- Usage: "urlex URL"
-- Parse arguments
local args = {...}
local url = args[1]
-- Load the page
local page = http.get(args[1])
src = page.readAll()
page.close()
-- Eval the page contents as Lua code
local func, error = loadstring(src)
if func then
func()
else
print("Error: ", error)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment