This is a set of Garry's Mod modules written by me mostly under linux32 (elf_i386) srcds on Netwide Assembler for fun and experience in assembler.
- gmsv_hello_linux: The simplest example. Outputs
Hello from Netwide Assembler!
to the console at startup. - gmsv_crc32_linux: Example with adding a own function to the lua global table.
TheCRC-32
algorithm is implemented as an function example.
Instead of declaring a ready CRC Table, it is generated in runtime by poly0xEDB88320
.
Function:number CRC32(string stringToChecksum)
. Btw this is much faster thanutil.CRC
. - Something else in the future (if I write more)
- Install
nasm
:sudo apt install nasm
- Copy
lua_shared_srv.so
from srcds folder to this folder (where Makefile)
Tip: file location in srcds:Steam\steamapps\common\GarrysModDS\garrysmod\bin\lua_shared_srv.so
- Run
make
- Copy dll's from folder to
lua/bin
folder of srcds
Tip: lua binary location in srcds:Steam\steamapps\common\GarrysModDS\garrysmod\lua\bin
- Change (or add) top line in
GarrysModDS\srcds_run
:
Note: this is to ensure that the dynamic linker finds all necessary dependencies when loading the module
export LD_LIBRARY_PATH=".:bin:garrysmod/bin:$LD_LIBRARY_PATH"
- Run modules in game!
lua_run require"hello" require"crc32"