read data from commandline arg

This commit is contained in:
Kartik K. Agaram 2023-10-17 15:34:12 -07:00
parent 08875d0094
commit a4e2eb65e8
6 changed files with 18 additions and 2 deletions

View File

@ -1,4 +1,5 @@
Data = {
-- example standings during the 2023 Cricket World Cup
Ind={Pak=2, Aus=2},
NZ={Eng=2},
SA={Aus=2, SL=2},

View File

@ -1,3 +1,7 @@
on.initialize = function(arg)
if #arg > 0 then
Results_filename = absolutize(arg[1])
Data = load_results(Results_filename)
end
Rows = ordered_keys(Data)
end
end

View File

@ -1,4 +1,6 @@
on.code_change = function()
Data = load_results(App.current_dir..'results')
if Results_filename then
Data = load_results(Results_filename)
end
Rows = ordered_keys(Data)
end

2
0021-Results_filename Normal file
View File

@ -0,0 +1,2 @@
-- Filename to maintain results in
Results_filename = nil

6
0022-absolutize Normal file
View File

@ -0,0 +1,6 @@
absolutize = function(path)
if is_relative_path(path) then
return App.current_dir..path
end
return path
end

View File

@ -11,3 +11,4 @@ NZ beat Ban
Ind beat Pak
Afg beat Eng
Aus beat SL
Ned beat SA