Skip to content

Modules

LabRicecat edited this page Nov 25, 2022 · 5 revisions

using

You can include native modules or modules out of the standard library.

using <module>

Native modules have to be:

  • on windows: C:\Program Files\.meowscript\lib\
  • on linux (*nix): ~/.meowscript/lib/

The standard library is always loaded.

Example:

# enabling module "os" from the stdlib
using os

# calling method "date" from the module os
os.date()

import

With the import command you can import other MeowScript file.

import "<file>"

If file has no extension, the parser tries again with file.mws
Imported files are executed in the same scope as the current scope.

Example:

# File A.mws

new a_ret 0

func A()->Number {
	return a_ret
}
# File B.mws

import "A"

A()
set a_ret 1
A()

If you run B.mws this will output:

0
1

>>> Next article

Clone this wiki locally