Skip to content

Commit

Permalink
Replace chunk_2 with script name
Browse files Browse the repository at this point in the history
* Fixed a bug that's existed for THREE YEARS where what should be the name of the script is replaced with `chunk_2`
  • Loading branch information
Eir-nya committed Sep 4, 2019
1 parent 2eaa1b1 commit 6825f7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Assets/Scripts/Battle/LuaEnemyEncounter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private void PrepareWave() {
for (int i = 0; i < waves.Length; i++) {
currentWaveScript = i;
DynValue ArenaStatus = UserData.Create(ArenaManager.luaStatus);
waves[i] = new ScriptWrapper();
waves[i] = new ScriptWrapper() { scriptname = nextWaves.Table.Get(i + 1).String };
waves[i].script.Globals.Set("Arena", ArenaStatus);
waves[i].script.Globals["EndWave"] = (Action)EndWaveTimer;
waves[i].script.Globals["State"] = (Action<Script, string>)UIController.SwitchStateOnString;
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Lua/ScriptWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ public ScriptWrapper(/*bool overworld = false*/) {
this.Bind("_getv", (Func<Script, string, DynValue>)this.GetVar);
string toDoString = "setmetatable({}, {__index=function(t, name) return _getv(name) end}) ";
text = toDoString;
script.DoString(toDoString);
script.DoString(toDoString, null, scriptname);
instances.Add(this);
}

~ScriptWrapper() {
instances.Remove(this);
}

internal DynValue DoString(string source) { return script.DoString(source); }
internal DynValue DoString(string source) { return script.DoString(source, null, scriptname); }

public void SetVar(string key, DynValue value) {
if (key == null)
Expand Down

0 comments on commit 6825f7e

Please sign in to comment.