Can you close a script?

There’s lua_openscript myscript.lua but is there a close function or is it file:close?

You seem to have a misunderstanding of what lua_openscript does. It opens the file and reads it, and then automatically closes it. It takes the resulting string and runs it through the compiler. The compiler turns this into bytecode, which is then loaded into the runtime environment, and stays there until the environment is shut down(client disconnecting or map switch, for example ).

What do you mean by close?

lua_openscript is a command to load the script file and run it once the script is done executing (by reaching the end of the file) that’s it. There’s nothing to “close”.

Darn. Ninja’d.

(client disconnecting or map switch, for example ). is there a way I can for close it?

Again, you misunderstand. At the most simple level, this is what the game is doing:
[LUA]
RunString( file.Read( “filename.lua”, “LUA” ) )
[/LUA]

file.Read automatically closes the file after reading it.

What are you trying to accomplish? I can most likely help you solve whatever problem you have in a different way.

he probably means undoing whatever the script did, like removing hooks and timers.