This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Gumball's profile picture

Pass arguments to file

Started by Gumball, 22 October 2015 - 11:03 AM
Gumball #1
Posted 22 October 2015 - 01: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!
KingofGamesYami #2
Posted 22 October 2015 - 01:26 PM

local func = loadfile( "thefileyouwanttorun" )
func( arguments )
Gumball #3
Posted 22 October 2015 - 01:39 PM

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 on 22 October 2015 - 11:39 AM
Bomb Bloke #4
Posted 22 October 2015 - 02:53 PM
local args = {...}
Gumball #5
Posted 22 October 2015 - 03:24 PM
local args = {...}

Spoopy. (it works, thanks :D/>)