RavMda / glua-steal-roc

Simply gluasteal but with roc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A cross-platform Garry's Mod tool that retrieves client-side Lua files from servers

gluasteal retrieves client-side & shared Lua files from Garry's Mod servers that you join. gluasteal also allows you to execute your own Lua code.

Windows usage Linux usage

Works on Windows & Linux (32-bit & 64-bit). Still needs testing on macOS.


How to Use

  1. Either Download pre-built from the Releases section or build from source.
  2. Inject library into Garry's Mod, at the main menu.
  3. Optionally, set up your Lua file to be loaded.
  4. Join a server.
The gluasteal Directory

Logs and Lua files will be written to the gluasteal folder, in your home directory.

  • Windows: C:/Users/username/Documents/gluasteal/
  • Linux: /home/username/gluasteal/
  • Mac: /Users/username/gluasteal/

How to Inject

Windows

  1. Get an injector
  2. Add the dll to the injector
  3. Select the Garry's Mod process
  4. Inject at the main menu

Linux

Method 1

linux-inject

Method 2

Editing the Garry's Mod launch script (hl2.sh) to preload the gluasteal library.

LD_PRELOAD=$LD_PRELOAD:/home/lewis/gluasteal.so

Method 3

Using gdb

Mac

Using DYLD_INSERT_LIBRARIES (see LD_PRELOAD above)


Lua Loader (Load Before Autorun)

Place your Lua code in your gluasteal directory, in a file named gluasteal.lua This file is executed in a separate environment, not in _G. You are still able to access everything stored in _G.

This file will be executed every time a Garry's Mod Lua script is about to be executed. You can return false to stop the current file (gluasteal.SCRIPT) from being executed.

You can also return a second bool to prevent gluasteal from saving the file.

-- All scripts with the string 'derma' in their name will be blocked from executing
if (gluasteal.SCRIPT:match("derma")) then
	return false, false
end
-- gluasteal.include example
-- runs "hook/newhook.lua" from your gluasteal folder, but gmod sees its path as "lua/includes/modules/hook.lua"
gluasteal.include('hook/newhook.lua', 'lua/includes/modules/hook.lua')
gluasteal.SCRIPT -- The path of the Garry's Mod Lua script that is about to be executed (e.g. "init.lua")
gluasteal.SOURCE -- The source code of the script that is about to be executed (e.g. "do return end")
gluasteal.VERSION -- The version of gluasteal being used
gluasteal.include -- A function to include other gluasteal Lua files, relative to the gluasteal directory - e.g. gluasteal.include("other.lua")

Note: gluasteal.SCRIPT and gluasteal.SOURCE will be an empty string in files included by gluasteal.include


RunOnClient (Run clientside lua from menu)

You can use RunOnClient function in menu state to run clientside code. Scripts runned with this method are also supplied with gluasteal table.

RunOnClient([[print('hello world!')]])

Building From Source

If building with GCC, ensure you are using at least version 8 or above.

Windows

Using the Visual Studio Developer Command Prompt (requires VS build tools)

git clone https://github.com/RavMda/glua-steal
cd glua-steal
git submodule update --init --recursive
mkdir build
cd build
cmake --help	Find a suitable generator, such as "Visual Studio 15 2017"
Select either Win32 or x64 below for the -A flag (32bit or 64bit)
cmake .. -A Win32/x64 -G <GENERATOR> -DCMAKE_TOOLCHAIN_FILE=../toolchains/msvc.cmake 
msbuild gluasteal.sln /p:Configuration=Release
Unix
git clone https://github.com/RavMda/glua-steal
cd glua-steal
git submodule update --init --recursive
mkdir build && cd build
choose the 32bit or 64bit toolchain below (toolchains are in toolchains/ folder)
cmake .. -DCMAKE_TOOLCHAIN_FILE=../toolchains/gcc-<32bit/64bit>.cmake
make

License

Copyright (C) 2019 Lewis Clark

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

About

Simply gluasteal but with roc

License:GNU General Public License v3.0


Languages

Language:C++ 96.7%Language:CMake 3.3%