Skip to content

Commit 2b62710

Browse files
committed
Added example.lua and removed its generation from the GitHub workflow
1 parent d450908 commit 2b62710

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

.github/workflows/LuaWatcom.yml

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,36 +43,14 @@ jobs:
4343
run: |
4444
cp $WATCOM/binw/dos4gw.exe dist/bin/
4545
46-
- name: Install Post Build Tools (Dos2unix, GNU Mtools, Zip)
46+
- name: Install Post Build Packaging Tools
4747
run: |
4848
sudo apt-get update
4949
sudo apt-get install -y dos2unix mtools zip
5050
51-
- name: Create Example Lua Script for Diskette Images
51+
- name: Ensure Lua Scripts Have CR/LF Line Endings
5252
run: |
53-
echo "-- This is a single line comment" > example.lua
54-
echo "-- Run this script with 'LUA16.EXE EXAMPLE.LUA'" >> example.lua
55-
echo "" >> example.lua
56-
echo "-- Get hour of the day, convert it from string to number" >> example.lua
57-
echo "hour = tonumber(os.date('%H'))" >> example.lua
58-
echo "" >> example.lua
59-
echo "-- Set the string 'timeOfDay' depending on the hour" >> example.lua
60-
echo "if hour < 4 or hour > 20 then timeOfDay = 'night'" >> example.lua
61-
echo "elseif hour < 9 then timeOfDay = 'morning'" >> example.lua
62-
echo "elseif hour > 16 then timeOfDay = 'evening'" >> example.lua
63-
echo "else timeOfDay = 'day'" >> example.lua
64-
echo "end" >> example.lua
65-
echo "" >> example.lua
66-
echo "-- Concatenate timeOfDay & Lua version to as part of a greeting" >> example.lua
67-
echo "print('Good ' .. timeOfDay .. ' from ' .. _VERSION .. '.')" >> example.lua
68-
echo "" >> example.lua
69-
echo "os.exit() -- Exit script. Will also exit a interactive shell" >> example.lua
70-
echo "" >> example.lua
71-
echo "--[[ This is a multi-line comment" >> example.lua
72-
echo " For full Lua language documentation" >> example.lua
73-
echo " visit https://www.lua.org/docs.html" >> example.lua
74-
echo "--]]" >> example.lua
75-
unix2dos example.lua
53+
unix2dos *.lua
7654
7755
- name: Create 160k Floppy Diskette Image
7856
run: |

example.lua

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env lua
2+
-- This is a single line comment, the line above is a shebang for UNIX systems
3+
4+
--[[ This is a multi-line comment. To run the script, pass it to the lua binary
5+
as an argument (`LUA16.EXE EXAMPLE.LUA` on 16-bit DOS for example).
6+
For full Lua language documentation visit https://www.lua.org/docs.html
7+
--]]
8+
9+
hour = tonumber(os.date('%H')) -- Get the hour of day on the computers clock
10+
if hour < 4 or hour > 20 then -- Convert hour into fuzzy time of day
11+
timeOfDay = 'night'
12+
elseif hour < 9 then
13+
timeOfDay = 'morning'
14+
elseif hour > 16 then
15+
timeOfDay = 'evening'
16+
else
17+
timeOfDay = 'day'
18+
end
19+
20+
print('Good ' .. timeOfDay .. ' from ' .. _VERSION .. '.') -- Print a greeting
21+
io.read() -- Wait for Enter to be pressed
22+
print('Have a good ' .. timeOfDay .. '.') -- This message will
23+
os.exit() -- Exit script. Will also exit a interactive shell

0 commit comments

Comments
 (0)