Changing scripts at runtime

pdoompdoom Join Date: 2008-08-07 Member: 64771Members
I noticed that Decoda has some problems handling scripts that change at runtime.
To investigate this, I created a simple app that executes SCRIPT1 (see below) at the press of a button.

<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
-- SCRIPT1:
tst = loadfile("c:\\test.lua");
tst();
</div>

where c:\test.lua looks like this:

<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
-- C:\TEST.LUA:
a = 5;
b = a+3;

decoda_output("Hello world!");
</div>

I do the following in Decoda:
- Create a new project
- Set the command to my app.exe
- 'Add existing file ...' c:\test.lua

- Run (F5)
- Hit the button in my app so SCRIPT1 gets executed

All works fine so far. Decoda correctly associates 'c:\test.lua' with the file already present in the project. I can set breakpoints in test.lua, watch values, and the text 'Hello World!' is shown in the debug output. Now I do the following:

- In Decoda, modify test.lua like this:

<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
-- C:\TEST.LUA:
a = 5;
b = a+3;
b = b+1;

decoda_output("Hello world!");

decoda_output("Hello again!");
</div>

- Save test.lua
- Hit the button in the app again, so SCRIPT1 gets executed again.

Now the debug output is as expected ('Hello World!' / 'Hello again!'), however, debugging test.lua doesn't work correctly anymore. It looks like the debugging commands (F10, setting breakpoints) think that test.lua is still in its original state, so F10 misses some of the lines containing code, and I can only set breakpoints on the lines that contained code in the original version of test.lua.

Is this a known issue? Or am I missing something?
We would like to use Decoda in a context where scripts are loaded from external files, and those files can be edited at run-time. But obviously we can't use Decoda here if it cannot handle changing scripts...

Thanks for any help!

Comments

  • pdoompdoom Join Date: 2008-08-07 Member: 64771Members
    Does nobody know anything about this? Anyone else reloading their scripts at runtime?...
  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer
    This is a known issue. Sorry for the delayed response, I missed your initial post. We're testing a new version that should improve this situation a bit.
Sign In or Register to comment.