8000 GitHub - TheNormalnij/MTA-package: Package library binding via module for MTA
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

TheNormalnij/MTA-package

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Building

Linux

cmake -B ./build ./
cmake --build ./build

Windows

For x86 MTA server:

cmake -A Win32 . -B build
cmake --build build --config Release

for x64 MTA server:

cmake -A x64 . -B build
cmake --build build --config Release

Installation

You can get prebuilded packages on GitHub releases page

Windows

  • 32 bit: Copy 32 bit ml_package.dll into the MTA San Andreas\server\mods\deathmatch\modules\ directory.
  • 64 bit: Copy 64 bit ml_package.dll into the MTA San Andreas\server\x64\modules\ directory.

Then, add the following line in mtaserver.conf:

  <module src="ml_package.dll" />

GNU/Linux

  • 32 bit: Copy 32 bit ml_package.so into the mods/deathmatch/modules/ directory.
  • 64 bit: Copy 64 bit ml_package.so into the x64/modules/ directory.

Then, add the following line in mtaserver.conf:

  <module src="ml_package.so" />

Usage

-- You can use absolute path for require function
-- The module start searching from 'mods/deathmatch/resources' folder
local module = require "folder1.folder2.resourceName.resourceFile"

-- Relative path is supported too. It starts with ":"
local module = require ":resourceName.resourceFile"

-- You can use "mods/deathmatch/lua/server" folder for shared code
local fooModule = require "mysmalllib"
local barModule = require "mylib.libfile"

LuaRocks integration

LuaRocks has some usefull native modules for Lua. require supports native modules.

Linux

  1. Install Lua and luarocks
sudo apt install luarocks lua5.1
  1. Copy scripts/luarocks.sh from this repository to your MTA server forlder.

  2. Now you can use luarocks.sh to build native modules

./luarocks.sh install rapidjson
local rapidjson = require "rapidjson"

Windows x86 only

  1. Install Visual Studio and CMake via Visual Studio Installer

  2. Copy scripts/luarocks.ps1 from this repository to your MTA server forlder.

  3. Now you can use luarocks.ps1 to build native modules with using powerschell console

.\luarocks.ps1 install rapidjson

About

Package library binding via module for MTA

Resources

License

Stars

Watchers

52DE

Forks

Packages

No packages published

Contributors 2

  •  
  •  
0