Skip to content

Commit

Permalink
revert setObjectOrder and getObjectOrder
Browse files Browse the repository at this point in the history
  • Loading branch information
LarryFrosty authored Oct 1, 2024
1 parent 0a075d0 commit 54ff3de
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions source/psychlua/FunkinLua.hx
Original file line number Diff line number Diff line change
Expand Up @@ -433,35 +433,30 @@ class FunkinLua {
});

//shitass stuff for epic coders like me B) *image of obama giving himself a medal*
Lua_helper.add_callback(lua, "getObjectOrder", function(obj:String, ?group:String = null) {
Lua_helper.add_callback(lua, "getObjectOrder", function(obj:String) {
var split:Array<String> = obj.split('.');
var leObj:FlxBasic = LuaUtils.getObjectDirectly(split[0]);
if(split.length > 1) {
leObj = LuaUtils.getVarInArray(LuaUtils.getPropertyLoop(split), split[split.length-1]);
}

if(leObj != null) {
var groupObj:Dynamic = LuaUtils.getObjectDirectly(group);
if (groupObj == null || !Std.isOfType(groupObj, FlxTypedGroup)) groupObj = LuaUtils.getTargetInstance();

return groupObj.members.indexOf(leObj);
if(leObj != null)
{
return LuaUtils.getTargetInstance().members.indexOf(leObj);
}
luaTrace("getObjectOrder: Object " + obj + " doesn't exist!", false, false, FlxColor.RED);
return -1;
});
Lua_helper.add_callback(lua, "setObjectOrder", function(obj:String, position:Int, ?group:String = null) {
Lua_helper.add_callback(lua, "setObjectOrder", function(obj:String, position:Int) {
var split:Array<String> = obj.split('.');
var leObj:FlxBasic = LuaUtils.getObjectDirectly(split[0]);
if(split.length > 1) {
leObj = LuaUtils.getVarInArray(LuaUtils.getPropertyLoop(split), split[split.length-1]);
}

if(leObj != null) {
var groupObj:Dynamic = LuaUtils.getObjectDirectly(group);
if (groupObj == null || !Std.isOfType(groupObj, FlxTypedGroup)) groupObj = LuaUtils.getTargetInstance();

groupObj.remove(leObj, true);
groupObj.insert(position, leObj);
LuaUtils.getTargetInstance().remove(leObj, true);
LuaUtils.getTargetInstance().insert(position, leObj);
return;
}
luaTrace("setObjectOrder: Object " + obj + " doesn't exist!", false, false, FlxColor.RED);
Expand Down

0 comments on commit 54ff3de

Please sign in to comment.