Module ammcore.server

Code server API.

Index

Module

localApi

Implements API for local code server.

remoteApi

Implements API for remote code server.

Class

ServerApi

Abstract code server API implementation.

Class

class ammcore.server.ServerApi : ammcore.class.Base

Abstract code server API implementation.

Server API bound to a concrete server should be requested from ammcore.bootloader.getCodeServerApi.

classmethod New(self: <T: ammcore.class.Base>) <T: ammcore.class.Base>

Constructor.

abstract lsPkg(self: ammcore.server.ServerApi) packages: table<string, ammcore.pkg.package.PackageVersion>

List all packages installed on the server.

Returns:

packages (table<string, ammcore.pkg.package.PackageVersion>) – installed on the server.

abstract getCode(self: ammcore.server.ServerApi, path: string | string[]) code?: string, realPath?: string

Find and return a file by its path.

If given an array of strings, then the first found file is returned. For example, server:getCode({ "a/b/_index.lua", "a/b.lua" }) will try "a/b/_index.lua" first, then "a/b.lua". It will return contents of the first file that exists.

Parameters:

path (string | string[]) – file path, including its extension.

Returns:
  • code? (string) – module code.

  • realPath? (string) – actual path to the lua file that contains the code.

abstract getAmmCoreVersion(self: ammcore.server.ServerApi) ammcore.pkg.version.Version

Get version of the AMM core.

abstract getAmmCoreCode(self: ammcore.server.ServerApi) version: ammcore.pkg.version.Version, code: string

Get code of the core module.

Returns: