Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement hscript-improved #13304

Closed
Prev Previous commit
Next Next commit
trace of elapsed time after loading script
  • Loading branch information
TheLeerName committed Sep 19, 2023
commit d2d62071614ef01bfec73c43d62bc358cfa20782
6 changes: 3 additions & 3 deletions source/psychlua/FunkinLua.hx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class FunkinLua {

public function new(scriptName:String) {
#if LUA_ALLOWED
var times:Float = Date.now().getTime();
lua = LuaL.newstate();
LuaL.openlibs(lua);

Expand Down Expand Up @@ -1445,7 +1446,7 @@ class FunkinLua {
CustomSubstate.implement(this);
ShaderFunctions.implement(this);
DeprecatedFunctions.implement(this);

try{
var result:Dynamic = LuaL.dofile(lua, scriptName);
var resultStr:String = Lua.tostring(lua, result);
Expand All @@ -1463,9 +1464,8 @@ class FunkinLua {
trace(e);
return;
}
trace('lua file loaded succesfully:' + scriptName);

call('onCreate', []);
trace('lua file loaded succesfully: $scriptName (${Std.int(Date.now().getTime() - times)}ms)');
#end
}

Expand Down
3 changes: 2 additions & 1 deletion source/psychlua/HScript.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ class HScript
{
#if HSCRIPT_ALLOWED
if(parent.hscript == null) {
var times:Float = Date.now().getTime();
parent.hscript = new HScript(parent);
trace('initialized hscript interp successfully: ${parent.scriptName}');
trace('initialized hscript interp successfully: ${parent.scriptName} (${Std.int(Date.now().getTime() - times)}ms)');
}
#end
}
Expand Down
3 changes: 2 additions & 1 deletion source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3160,6 +3160,7 @@ class PlayState extends MusicBeatState

try
{
var times:Float = Date.now().getTime();
var newScript:HScript = new HScript(null, file);
hscriptArray.push(newScript);

Expand All @@ -3178,7 +3179,7 @@ class PlayState extends MusicBeatState
}
}

trace('initialized hscript interp successfully: $file');
trace('initialized hscript interp successfully: $file (${Std.int(Date.now().getTime() - times)}ms)');
}
catch(e)
{
Expand Down
Loading