Page content refreshing in CGILua

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Page content refreshing in CGILua

jitesh pabla
Hello everyone,

I am using CGILua (keplerproject.github.io/cgilua/) in a project in which the data displayed on the page is constantly changing (The data being a table being imported from some other lua script). But I cannot get the data to update on the CGILua page unless I make a change in the source page to force CGILua to re-run the Lua code in that page.
I am using Xavante as a server to run it (keplerproject.github.io/xavante/).

A small example:

in index.lp file:
```
<?lua 
ofile = require "otherfile"
print(ofile.var)
?>
```

in otherfile.lua file:
```
otherfile = {}
otherfile.var = "hello world"
return otherfile
```

Now, if I run index.lp on xavante, it will print "hello world", but while keeping the page running , if I change the string to "hello lua", save everything, and then refresh index.lp in my browser - it would still display "hello world".

The work around for this has been to just to add ```os.execute("touch list.lp")``` in index.lp.

Is there any better way to make CGILua re-run the lua code?
Reply | Threaded
Open this post in threaded view
|

Re: Page content refreshing in CGILua

Pierre Chapuis
On Mon, Jul 23, 2018, at 18:47, jitesh pabla wrote:
Hello everyone,

I am using CGILua (keplerproject.github.io/cgilua/) in a project in which the data displayed on the page is constantly changing (The data being a table being imported from some other lua script). But I cannot get the data to update on the CGILua page unless I make a change in the source page to force CGILua to re-run the Lua code in that page.

You may want to change the reload option in CGILua [1].

Be careful not to do that in production if you have a lot of traffic, for performance reasons...


--
Pierre Chapuis
Reply | Threaded
Open this post in threaded view
|

Re: Page content refreshing in CGILua

jitesh pabla
Thank you for the answer, but it still doesn't seem to work for me.
Also, it seems like there are 2 separate launchers in the same directory, could it be possible that it might be running the other one (without the extra options)?

--
Jitesh Pabla

On Tue, Jul 24, 2018 at 1:46 PM, Pierre Chapuis <[hidden email]> wrote:
On Mon, Jul 23, 2018, at 18:47, jitesh pabla wrote:
Hello everyone,

I am using CGILua (keplerproject.github.io/cgilua/) in a project in which the data displayed on the page is constantly changing (The data being a table being imported from some other lua script). But I cannot get the data to update on the CGILua page unless I make a change in the source page to force CGILua to re-run the Lua code in that page.

You may want to change the reload option in CGILua [1].

Be careful not to do that in production if you have a lot of traffic, for performance reasons...


--
Pierre Chapuis