Jump to content




Pass arguments to file


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

#1 Gumball

  • Members
  • 254 posts
  • LocationFairbanks, Alaska

Posted 22 October 2015 - 12:03 PM

How would I pass arguments to a file using loadfile()? I need to pass arguments to a file somehow, while it acts as a function.
Why? I'm making an OS with utilities I have created, and since I don't want 30 lines for a function, I would like to have a file have sets of utilities for the OS, like how real operating systems do things. So how would I do this? I am creating an alert box, and I want to be able to pass text. Thanks!

#2 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 22 October 2015 - 12:26 PM

local func = loadfile( "thefileyouwanttorun" )
func( arguments )


#3 Gumball

  • Members
  • 254 posts
  • LocationFairbanks, Alaska

Posted 22 October 2015 - 12:39 PM

View PostKingofGamesYami, on 22 October 2015 - 12:26 PM, said:

local func = loadfile( "thefileyouwanttorun" )
func( arguments )

I need to get the arguments into the actual program. I know how to pass arguments, but I need the code to actually take account of that.

Edited by bluebird173, 22 October 2015 - 12:39 PM.


#4 Bomb Bloke

    Hobbyist Coder

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

Posted 22 October 2015 - 01:53 PM

local args = {...}


#5 Gumball

  • Members
  • 254 posts
  • LocationFairbanks, Alaska

Posted 22 October 2015 - 02:24 PM

View PostBomb Bloke, on 22 October 2015 - 01:53 PM, said:

local args = {...}

Spoopy. (it works, thanks :D)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users