forked from cheat-engine/cheat-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LuaBinary.pas
executable file
·81 lines (66 loc) · 1.81 KB
/
LuaBinary.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
unit LuaBinary;
{$mode delphi}
interface
uses
Classes, SysUtils, lua;
procedure initializeLuaBinary;
implementation
uses luahandler;
function bOr(L: PLua_state): integer; cdecl;
begin
result:=1;
if lua_gettop(L)=2 then
lua_pushinteger(L, lua_tointeger(L, 1) or lua_tointeger(L,2))
else
raise exception.create(rsIncorrectNumberOfParameters);
end;
function bXor(L: PLua_state): integer; cdecl;
begin
result:=1;
if lua_gettop(L)=2 then
lua_pushinteger(L, lua_tointeger(L, 1) xor lua_tointeger(L,2))
else
raise exception.create(rsIncorrectNumberOfParameters);
end;
function bAnd(L: PLua_state): integer; cdecl;
begin
result:=1;
if lua_gettop(L)=2 then
lua_pushinteger(L, lua_tointeger(L, 1) and lua_tointeger(L,2))
else
raise exception.create(rsIncorrectNumberOfParameters);
end;
function bShl(L: PLua_state): integer; cdecl;
begin
result:=1;
if lua_gettop(L)=2 then
lua_pushinteger(L, lua_tointeger(L, 1) shl lua_tointeger(L,2))
else
raise exception.create(rsIncorrectNumberOfParameters);
end;
function bShr(L: PLua_state): integer; cdecl;
begin
result:=1;
if lua_gettop(L)=2 then
lua_pushinteger(L, lua_tointeger(L, 1) shr lua_tointeger(L,2))
else
raise exception.create(rsIncorrectNumberOfParameters);
end;
function bNot(L: PLua_state): integer; cdecl;
begin
result:=1;
if lua_gettop(L)=1 then
lua_pushinteger(L, not lua_tointeger(L, 1))
else
raise exception.create(rsIncorrectNumberOfParameters);
end;
procedure initializeLuaBinary;
begin
lua_register(LuaVM, 'bOr', bOr);
lua_register(LuaVM, 'bXor', bXor);
lua_register(LuaVM, 'bAnd', bAnd);
lua_register(LuaVM, 'bShl', bShl);
lua_register(LuaVM, 'bShr', bShr);
lua_register(LuaVM, 'bNot', bNot);
end;
end.