Browse Source

Made things a bit cleaner

master
Ludovic 'Archivist' Lagouardette 3 years ago
parent
commit
9ce58d42ae
2 changed files with 5 additions and 3 deletions
  1. +4
    -2
      scripts/my_func.lua
  2. +1
    -1
      src/app/button.ecr

+ 4
- 2
scripts/my_func.lua View File

@ -2,12 +2,14 @@ function run_event(name)
print("run " .. name) print("run " .. name)
if(name == "archivist") then if(name == "archivist") then
Business.fetch_add(10) Business.fetch_add(10)
else
elseif(name == "reset") then
Business.fetch_add(-Business.fetch_add(0))
else
Business.fetch_add(1) Business.fetch_add(1)
end end
end end
function display_event(name) function display_event(name)
print("display " .. name) print("display " .. name)
return Business.fetch_add(0)
return tostring(Business.fetch_add(0))
end end

+ 1
- 1
src/app/button.ecr View File

@ -2,7 +2,7 @@
<html> <html>
<head></head> <head></head>
<body> <body>
<div> <%= display_event.as(Lua::Function).call(name).as(Float64).to_i32!; %> </div>
<div> <%= display_event.as(Lua::Function).call(name).as(String); %> </div>
<form method="POST" action=<%= "/"+name %>> <form method="POST" action=<%= "/"+name %>>
<input type="submit" value="Go"> <input type="submit" value="Go">
</form> </form>

Loading…
Cancel
Save