Skip to content

Commit

Permalink
Merge pull request #15331 from LarryFrosty/prop-and-substate
Browse files Browse the repository at this point in the history
Make setProperty return the value and fix custom substate hscript variables
  • Loading branch information
ShadowMario committed Sep 1, 2024
2 parents 8476665 + 16bb140 commit 0c53fa2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions source/psychlua/CustomSubstate.hx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ class CustomSubstate extends MusicBeatSubstate
}
}
PlayState.instance.openSubState(new CustomSubstate(name));
PlayState.instance.setOnHScript('customSubstate', instance);
PlayState.instance.setOnHScript('customSubstateName', name);
}

public static function closeCustomSubstate()
Expand All @@ -51,7 +49,6 @@ class CustomSubstate extends MusicBeatSubstate
if(instance != null)
{
var tagObject:FlxObject = cast (MusicBeatState.getVariables().get(tag), FlxObject);
#if LUA_ALLOWED if(tagObject == null) tagObject = cast (MusicBeatState.getVariables().get(tag), FlxObject); #end

if(tagObject != null)
{
Expand All @@ -66,6 +63,8 @@ class CustomSubstate extends MusicBeatSubstate
override function create()
{
instance = this;
PlayState.instance.setOnHScript('customSubstate', instance);


PlayState.instance.callOnScripts('onCustomSubstateCreate', [name]);
super.create();
Expand All @@ -75,6 +74,7 @@ class CustomSubstate extends MusicBeatSubstate
public function new(name:String)
{
CustomSubstate.name = name;
PlayState.instance.setOnHScript('customSubstateName', name);
super();
cameras = [FlxG.cameras.list[FlxG.cameras.list.length - 1]];
}
Expand Down
4 changes: 2 additions & 2 deletions source/psychlua/ReflectionFunctions.hx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class ReflectionFunctions
var split:Array<String> = variable.split('.');
if(split.length > 1) {
LuaUtils.setVarInArray(LuaUtils.getPropertyLoop(split, true, allowMaps), split[split.length-1], value, allowMaps);
return true;
return value;
}
LuaUtils.setVarInArray(LuaUtils.getTargetInstance(), variable, value, allowMaps);
return true;
return value;
});
Lua_helper.add_callback(lua, "getPropertyFromClass", function(classVar:String, variable:String, ?allowMaps:Bool = false) {
var myClass:Dynamic = Type.resolveClass(classVar);
Expand Down

0 comments on commit 0c53fa2

Please sign in to comment.