Jump to content




[solved] Program to alter craftOS


  • You cannot reply to this topic
2 replies to this topic

#1 CCJJSax

  • Members
  • 262 posts

Posted 11 June 2016 - 01:38 AM

I use sublime to code and I like the colors. The colors are automatically there when you use a .lua file. If I had a file named blah.lua, I want to be able to go to a computer and run "blah" and have it search for "blah" then try "blah.lua". The 2 ways I can think of to do this are to edit craftOS in the computercraft files which I don't want to do, or run a separate program with it as an argument. ie. "run blah", which defeats the purpose.

Edited by CCJJSax, 11 June 2016 - 02:36 AM.


#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 11 June 2016 - 01:54 AM

At a glance, it looks like you may be able to do this by overriding shell.resolveProgram():

local oldShellResolve = shell.resolveProgram

shell.resolveProgram = function(program)
  return oldShellResolve(program) or oldShellResolve(program .. ".lua")
end

... though I haven't tested this.

#3 CCJJSax

  • Members
  • 262 posts

Posted 11 June 2016 - 02:35 AM

View PostBomb Bloke, on 11 June 2016 - 01:54 AM, said:

At a glance, it looks like you may be able to do this by overriding shell.resolveProgram():

local oldShellResolve = shell.resolveProgram

shell.resolveProgram = function(program)
  return oldShellResolve(program) or oldShellResolve(program .. ".lua")
end

... though I haven't tested this.

You sir, are a genius! Works wonders





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users