Skip to content

Commit 8cc4f64

Browse files
authored
Merge pull request #1299 from JordanSantiagoYT/refactor/hxluajit
refactor: replace linc_luajit with hxluajit
2 parents 2136259 + a8b7fd9 commit 8cc4f64

File tree

16 files changed

+441
-105
lines changed

16 files changed

+441
-105
lines changed

Project.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,8 @@
124124
<!--JS stuff needed-->
125125
<haxelib name="hscript" />
126126
<haxedef name="hscriptPos" />
127-
<haxelib name="linc_luajit" if="LUA_ALLOWED"/>
127+
<haxelib name="hxluajit" if="LUA_ALLOWED"/>
128128
<haxelib name="tjson" />
129-
<!--<haxelib name="hxCodec" if="VIDEOS_ALLOWED"/>-->
130-
131129
<haxelib name="hxvlc" if="VIDEOS_ALLOWED"/>
132130

133131
<haxelib name="hxdiscord_rpc" if="DISCORD_ALLOWED" />

hmm.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@
7575
"url": "https://github.com/MAJigsaw77/hxdiscord_rpc"
7676
},
7777
{
78-
"name": "linc_luajit",
78+
"name": "hxluajit",
7979
"type": "git",
8080
"dir": null,
8181
"ref": "master",
82-
"url": "https://github.com/JS-Engine-things/linc_luajit"
82+
"url": "https://github.com/JS-Engine-things/hxluajit"
8383
},
8484
{
8585
"name": "funkin.vis",

setup/unix.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ haxelib git away3d https://github.com/moxie-coder/away3d --quiet
1818
haxelib git tjson https://github.com/moxie-coder/tjson --quiet
1919
haxelib git hxcpp https://github.com/FunkinCrew/hxcpp --quiet
2020
haxelib git flxanimate https://github.com/Dot-Stuff/flxanimate 768740a56b26aa0c072720e0d1236b94afe68e3e --quiet
21-
haxelib git linc_luajit https://github.com/JS-Engine-things/linc_luajit --quiet
21+
haxelib git hxluajit https://github.com/JS-Engine-things/hxluajit --quiet
2222
haxelib git funkin.vis https://github.com/JS-Engine-things/funkVis-FrequencyFixed --quiet
2323
haxelib git grig.audio https://github.com/JS-Engine-things/grig.audio --quiet
2424
haxelib git hxdiscord_rpc https://github.com/MAJigsaw77/hxdiscord_rpc --quiet --skip-dependencies

setup/windows.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ haxelib git away3d https://github.com/moxie-coder/away3d --quiet
1616
haxelib git tjson https://github.com/moxie-coder/tjson --quiet
1717
haxelib git hxcpp https://github.com/FunkinCrew/hxcpp --quiet
1818
haxelib git flxanimate https://github.com/Dot-Stuff/flxanimate 768740a56b26aa0c072720e0d1236b94afe68e3e --quiet
19-
haxelib git linc_luajit https://github.com/JS-Engine-things/linc_luajit --quiet
19+
haxelib git hxluajit https://github.com/JS-Engine-things/hxluajit --quiet
2020
haxelib git funkin.vis https://github.com/JS-Engine-things/funkVis-FrequencyFixed --quiet
2121
haxelib git grig.audio https://github.com/JS-Engine-things/grig.audio --quiet
2222
haxelib git hxdiscord_rpc https://github.com/MAJigsaw77/hxdiscord_rpc --quiet --skip-dependencies

source/Achievements.hx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import flixel.FlxCamera;
33
#if ACHIEVEMENTS_ALLOWED
44
import haxe.Exception;
55
import objects.AchievementPopup;
6+
#if LUA_ALLOWED
7+
import psychlua.FunkinLua.State;
8+
#end
69

710
typedef Achievement =
811
{
@@ -261,7 +264,7 @@ class Achievements {
261264
#if LUA_ALLOWED
262265
public static function addLuaCallbacks(lua:State)
263266
{
264-
Lua_helper.add_callback(lua, "getAchievementScore", function(name:String):Float
267+
Convert.addCallback(lua, "getAchievementScore", function(name:String):Float
265268
{
266269
if(!achievements.exists(name))
267270
{
@@ -270,7 +273,7 @@ class Achievements {
270273
}
271274
return getScore(name);
272275
});
273-
Lua_helper.add_callback(lua, "setAchievementScore", function(name:String, ?value:Float = 1, ?saveIfNotUnlocked:Bool = true):Float
276+
Convert.addCallback(lua, "setAchievementScore", function(name:String, ?value:Float = 1, ?saveIfNotUnlocked:Bool = true):Float
274277
{
275278
if(!achievements.exists(name))
276279
{
@@ -279,7 +282,7 @@ class Achievements {
279282
}
280283
return setScore(name, value, saveIfNotUnlocked);
281284
});
282-
Lua_helper.add_callback(lua, "addAchievementScore", function(name:String, ?value:Float = 1, ?saveIfNotUnlocked:Bool = true):Float
285+
Convert.addCallback(lua, "addAchievementScore", function(name:String, ?value:Float = 1, ?saveIfNotUnlocked:Bool = true):Float
283286
{
284287
if(!achievements.exists(name))
285288
{
@@ -288,7 +291,7 @@ class Achievements {
288291
}
289292
return addScore(name, value, saveIfNotUnlocked);
290293
});
291-
Lua_helper.add_callback(lua, "unlockAchievement", function(name:String):Dynamic
294+
Convert.addCallback(lua, "unlockAchievement", function(name:String):Dynamic
292295
{
293296
if(!achievements.exists(name))
294297
{
@@ -297,7 +300,7 @@ class Achievements {
297300
}
298301
return unlock(name);
299302
});
300-
Lua_helper.add_callback(lua, "isAchievementUnlocked", function(name:String):Dynamic
303+
Convert.addCallback(lua, "isAchievementUnlocked", function(name:String):Dynamic
301304
{
302305
if(!achievements.exists(name))
303306
{
@@ -306,7 +309,7 @@ class Achievements {
306309
}
307310
return isUnlocked(name);
308311
});
309-
Lua_helper.add_callback(lua, "achievementExists", function(name:String) return achievements.exists(name));
312+
Convert.addCallback(lua, "achievementExists", function(name:String) return achievements.exists(name));
310313
}
311314
#end
312315
#end

source/DiscordClient.hx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import cpp.ConstCharStar;
66
import cpp.Function;
77
import cpp.RawConstPointer;
88
#end
9+
#if LUA_ALLOWED
10+
import psychlua.FunkinLua.State;
11+
#end
912

1013
import hxdiscord_rpc.Discord;
1114
import hxdiscord_rpc.Types;
@@ -150,8 +153,8 @@ class DiscordClient
150153
#if LUA_ALLOWED
151154
public static function addLuaCallbacks(lua:State)
152155
{
153-
Lua_helper.add_callback(lua, "changeDiscordPresence", changePresence);
154-
Lua_helper.add_callback(lua, "changeDiscordClientID", function(?newID:String) {
156+
Convert.addCallback(lua, "changeDiscordPresence", changePresence);
157+
Convert.addCallback(lua, "changeDiscordClientID", function(?newID:String) {
155158
if(newID == null) newID = _defaultID;
156159
clientID = newID;
157160
});

source/Main.hx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ class Main extends Sprite {
7878
FlxG.sound = soundFrontEnd;
7979
funkinGame._customSoundTray = objects.CustomSoundTray.CustomSoundTray;
8080
}
81-
// turns out I forgot this, I'm a bit dumb for that
82-
#if LUA_ALLOWED Lua.set_callbacks_function(cpp.Callable.fromStaticFunction(psychlua.CallbackHandler.call)); #end
8381

8482
addChild(funkinGame);
8583

source/import.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import sys.io.*;
77
#end
88

99
#if LUA_ALLOWED
10-
import llua.*;
11-
import llua.Lua;
10+
import hxluajit.*;
11+
import hxluajit.Types;
1212
import psychlua.*;
1313
#else
1414
import psychlua.FunkinLua; // TODO: test and seperate this into LuaUtils

source/psychlua/CallbackHandler.hx

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)