Calling a function from another file

How would I go about calling a function from another file?

From my init.lua I have a command Check(ply) that references Info(ply) in cl_init.lua. How would I call that properly, seeing as just doing
[lua]function check(ply)
if returnedvalue1 == returnedvalue2 then
–Run code here
–Run code here
Does not want to work. (info(ply) sends a derma input with 2 things to input, returning them as “return returnedvalue1, returnedvalue2”)

Normally calling a function from another file is fine since they’re global. eg

function a(myarg)
return myarg * 2

function doubled(num)

That would work fine and calling doubled(num) would print the double of what you passed as an argument. But init.lua and cl_init.lua are running on different machines. So the info function never existed on the server.

You’d have to make the server function first send a command to the player telling his client machine to open the menu. Then make the submit button send another command from the client to the server (sending the text box (?) content as arguments) which the server will handle.

Basically you can’t call functions that only exist on the other side of the client-server line.

Generally if you want to access functions from another file, at the top of the file you use:

include( 'filename.lua' )

No you don’t, that includes the file in the current Lua state - for example, the game environment or menu environment

What? It can function to access tables and functions from other files…

include just runs the file doesn’t it.

including a file with a local function or variable in it doesn’t give you access to that function or variable. It’s not like some other languages’ include where it’s like you copypasted the code where the include is.