lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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?