Jump to content




Make program global

lua

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

#1 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 20 April 2013 - 10:27 AM

Howdy, I have an problem while making my OS - How do I make programs global (if it's possible) without editing mod files (like for example "edit" is global)?


Thanks for help :)



#2 Sammich Lord

    IRC Addict

  • Members
  • 1,212 posts
  • LocationThe Sammich Kingdom

Posted 20 April 2013 - 10:34 AM

IIRC, the shell first checks the CWD to see if the file is there then if so runs it, if it isn't in there then it checks the ROM and if it is in runs it, if not it does nothing.

#3 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 20 April 2013 - 10:36 AM

mkay, gonna have to overwrite CC's console or fs D:

#4 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 20 April 2013 - 10:38 AM

For a single file to be available on all computers, it needs to be in /rom/ someplace, in the mod's files, on the server.

#5 Sammich Lord

    IRC Addict

  • Members
  • 1,212 posts
  • LocationThe Sammich Kingdom

Posted 20 April 2013 - 10:39 AM

View PostLyqyd, on 20 April 2013 - 10:38 AM, said:

For a single file to be available on all computers, it needs to be in /rom/ someplace, in the mod's files, on the server.
I believe he meant on the single computer that you can access in any CWD like the scripts in ROM.

#6 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 20 April 2013 - 10:41 AM

View PostSammich Lord, on 20 April 2013 - 10:39 AM, said:

View PostLyqyd, on 20 April 2013 - 10:38 AM, said:

For a single file to be available on all computers, it needs to be in /rom/ someplace, in the mod's files, on the server.
I believe he meant on the single computer that you can access in any CWD like the scripts in ROM.

Exactly

#7 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 20 April 2013 - 10:45 AM

View PostSammich Lord, on 20 April 2013 - 10:39 AM, said:

View PostLyqyd, on 20 April 2013 - 10:38 AM, said:

For a single file to be available on all computers, it needs to be in /rom/ someplace, in the mod's files, on the server.
I believe he meant on the single computer that you can access in any CWD like the scripts in ROM.

Ah. His original post was ambiguous.

OP, look into shell.path (or shell.getPath, I can never remember which it is) and shell.setPath.

#8 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 20 April 2013 - 10:47 AM

mkay :)

#9 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 20 April 2013 - 10:49 AM

View PostLyqyd, on 20 April 2013 - 10:45 AM, said:

OP, look into shell.path (or shell.getPath, I can never remember which it is) and shell.setPath.

The shell path function always confused me. I wish it were just a combined getter and setter, so you could do something like this:
shell.path(shell.path() .. ':/bin')


#10 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 20 April 2013 - 10:50 AM

Yeah, there is no documentation about shell.path() in wiki. Anyone has an example code?

#11 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 20 April 2013 - 11:30 AM

shell.path() returns the path, shell.setPath() sets the current path. To append "/bin" to the current path (like I did before):

shell.setPath(shell.path() .. ':/bin')

The colon is there because each individual path is separated by a colon. If you wanted to add more paths, you could make a nice function for it:
function addPath(path)
  shell.setPath(shell.path()..':'..path)
end

addPath '/bin'
addPath '/usr/home'
addPath '/usr/lib'

Or something like that.

#12 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 20 April 2013 - 11:42 AM

Thanks! :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users