Skip to content

Commit a13a852

Browse files
committed
misc.libver() added
1 parent fc1f08d commit a13a852

File tree

9 files changed

+35
-12
lines changed

9 files changed

+35
-12
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ jobs:
1717

1818
- name: Get previous tag
1919
id: prevtag
20-
uses: WyriHaximus/github-action-get-previous-tag@v1
21-
with:
22-
fallback: '0.1'
20+
run: |
21+
Write-Host "::set-output name=tag::$(GIT.EXE describe --abbrev=0 --tags ${{ github.ref_name }}`^)"
2322
2423
- name: Checkout LuaJIT
2524
uses: actions/checkout@v3
@@ -42,8 +41,8 @@ jobs:
4241

4342
- name: Build release archive
4443
run: |
45-
mkdir .\objs\output\RedLua\
46-
copy LICENSE README.md .\objs\output\
44+
New-Item -Path ".\objs\output\" -Name "RedLua" -ItemType "directory"
45+
Copy-Item .\LICENSE,.\README.md .\objs\output\
4746
curl.exe -o.\objs\output\RedLua\natives.json https://raw.githubusercontent.com/alloc8or/rdr3-nativedb-data/master/natives.json
4847
7z.exe a -tzip .\objs\out.zip .\objs\output\*.* -r
4948

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "Run standalone",
55
"type": "cppvsdbg",
66
"request": "launch",
7-
"program": "D:\\luajit\\src\\luajit.exe",
7+
"program": "D:\\LuaJIT\\src\\LuaJIT.exe",
88
"args": ["sl_test.lua"],
99
"stopAtEntry": false,
1010
"cwd": "${workspaceFolder}\\objs\\output\\",

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ RedLua uses the [**Easylogging++**](https://github.com/amrayn/easyloggingpp#conf
3535

3636
## Scripting
3737

38-
RedLua searches for scripts in the `<Your game directory>\RedLua\Scripts\`. Each script located in this folder will be loaded automatically (If the `Autorun feature` is enabled). Every script should return a `table` (can be empty) with functions `OnLoad`, `OnTick`, `OnStop`.
38+
RedLua searches for scripts in the `<Your game directory>\RedLua\Scripts\`. Each script located in this folder will be loaded automatically (If the `Autorun feature` is enabled). Every script should return a `table` (can be empty) with functions `OnLoad`, `OnTick`, `OnStop`. Almost every function of the RDR2's RAGE is described [here](https://alloc8or.re/rdr3/nativedb/) and [here](https://www.rdr2mods.com/nativedb/index/builtin/).
3939

4040
Example:
4141
```lua
@@ -100,6 +100,15 @@ function t.OnTick()
100100

101101
UIFEED:_UI_FEED_POST_SAMPLE_TOAST(duration, data, true, true)
102102
end
103+
-- If you press F9 it will knock out all peds around you
104+
if mish.iskeyjustup(VK_F9, true) then
105+
local cnt = native.allpeds(mod.ent_arr) - 1
106+
for i = 0, cnt do
107+
if mod.ent_arr[i] ~= mod.me_ent then
108+
TASK:TASK_KNOCKED_OUT(mod.ent_arr[i], 10, false)
109+
end
110+
end
111+
end
103112
end
104113

105114
return t
@@ -150,8 +159,15 @@ misc.resetkey(VK_*)
150159

151160
-- Get game version
152161
misc.gamever() -- Returns: number, e.g. 1436.31
162+
163+
-- Get RedLua version
164+
misc.libver() -- Returns: integer, e.g. 010, 020, etc.
153165
```
154166

167+
## Contribution
168+
169+
This is my first project that uses C++, so I'm not really good at it. If you see some cursed code and you know how to improve it, PRs are welcome.
170+
155171
## Thanks
156172

157173
Thanks to [Mike Pall](https://github.com/LuaJIT/LuaJIT), [Alexander Blade](https://www.dev-c.com/rdr2/scripthookrdr2/), [alloc8or](https://github.com/alloc8or/rdr3-nativedb-data), [Niels Lohmann](https://github.com/nlohmann/json) and [abumusamq](https://github.com/amrayn/easyloggingpp) for all their awesome work.

build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ IF NOT "%VSCMD_ARG_TGT_ARCH%"=="x64" (
44
EXIT /B 1
55
)
66
setlocal enableextensions enabledelayedexpansion
7-
SET RL_LUAJIT_SOURCE_DIR=.\src\thirdparty\luajit\src
7+
SET RL_LUAJIT_SOURCE_DIR=.\src\thirdparty\LuaJIT\src
88
IF NOT EXIST "%RL_LUAJIT_SOURCE_DIR%\lua51.lib" (
99
PUSHD %RL_LUAJIT_SOURCE_DIR%
1010
CALL .\msvcbuild.bat

src/luamisc.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#ifndef REDLUA_STANDALONE
44
#include "luamisc.hpp"
5+
#include "constants.hpp"
6+
57
#include "thirdparty\keyboard.h"
68
#include "thirdparty\ScriptHook\inc\main.h"
79
static lua_Number GameVer;
@@ -78,13 +80,19 @@ static int misc_gamever(lua_State *L) {
7880
return 1;
7981
}
8082

83+
static int misc_libver(lua_State *L) {
84+
lua_pushinteger(L, REDLUA_VERSION_NUM);
85+
return 1;
86+
}
87+
8188
static luaL_Reg misclib[] = {
8289
{"iskeydown", misc_iskeydown},
8390
{"iskeydownlong", misc_iskeydownlong},
8491
{"iskeyjustup", misc_iskeyjustup},
8592
{"resetkey", misc_resetkey},
8693

8794
{"gamever", misc_gamever},
95+
{"libver", misc_libver},
8896

8997
{NULL, NULL}
9098
};

src/luamisc.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#pragma once
22

3-
#include "thirdparty\luajit\src\lua.hpp"
3+
#include "thirdparty\LuaJIT\src\lua.hpp"
44

55
int luaopen_misc(lua_State *L);

src/luanative.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include "thirdparty\luajit\src\lua.hpp"
3+
#include "thirdparty\LuaJIT\src\lua.hpp"
44

55
void luaclose_native(lua_State *L);
66

src/native/cache.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include "thirdparty\luajit\src\lua.hpp"
3+
#include "thirdparty\LuaJIT\src\lua.hpp"
44
#include "native\types.hpp"
55
#include <map>
66

src/redlua.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "constants.hpp"
55

66
#include <string>
7-
#include "thirdparty\luajit\src\lua.hpp"
7+
#include "thirdparty\LuaJIT\src\lua.hpp"
88
#include "thirdparty\easyloggingpp.h"
99

1010
extern const luaL_Reg redlibs[];

0 commit comments

Comments
 (0)