kikito / lua_missions Goto Github PK
View Code? Open in Web Editor NEWLua Koans, minus the Zen stuff
Home Page: https://github.com/kikito/lua_missions
Lua Koans, minus the Zen stuff
Home Page: https://github.com/kikito/lua_missions
Rake was introduced as a "quick and dirty" commodity - Lua missions was inspired by Ruby Koans, so it was easy to just copy the Koans' rakefile and start from there.
Much as I like ruby, I think requiring it just to work with some Lua files is a bit weird. Ideally, if you already have Lua, you shouldn't need anything else to work with the lua-missions (appart from git, if you are making a pr)
The current rakefile has the following tasks:
$ rake -T
rake git:add # add all the modifications to the git repository, including deletions
rake git:commit # Commit with a message
rake git:push # Push to origin
rake git:release # regenerate missions & push to the git repository
rake missions:delete # Delete the generated mission files
rake missions:gen # Generate the Missions from the changed source files
rake missions:regen # Generate the Missions from the source files from scratch
rake missions:run # Trying to execute the missions
rake missions:run_src # Execute the solved missions
git
namespace (git:add
, etc) can be ignored - most of them can be replaced by 1 or 2 simple git commands.missions:delete
is only a "pre-task" used by mission:regen
missions:gen
is a nice-to-have, but isn't really needed (as long as you have missions:regen
)missions:run
does literally cd missions; lua missions.lua
. And missions:run_src
does something similar. I am quite tempted to just ignore them. If not, creating a lua script which executes them is fairly trivial.So I think only missions:regen
is needed. What I am thinking about is a lua script called script/generate.lua
, which does what missions:regen
currently does:
__(<anything>)
by __
-- begin skip
and -- end skip
, both includedThis is troublesome for several reasons:
__(<anything>)
. In the current rakefile this is done using regular expressions.The CONTRIBUTING file would have to be updated too, before this issue is closed.
In line 82 of variables.lua, comment states
-- we'll probably not learn about coroutines in our missions.
As far as i can tell coroutines are covered in coroutines.lua, so does this need to be removed?
Trying to get it work in Ubuntu 22.04 and EndeavourOS (Arch Linux based) I run
$ lua missions.lua
and get
Assertion failed: Expected false to be true
The error happened here:
asserts.lua:2: in function <asserts.lua:1>
lua5.1: ./lib/agent.lua:153: attempt to concatenate a nil value
stack traceback:
./lib/agent.lua:153: in function 'mission_print_report'
./lib/agent.lua:239: in function 'print_report'
./lib/agent.lua:253: in function 'execute'
missions.lua:31: in main chunk
[C]: ?
The same happens with lua 5.2, 5.3 or 5.4
I just finished the metatables file, purely from guesswork or cheating from the console.
Metatables are not at all well explained. I'll have to look up a guide elsewhere to have any idea as to what those things are, or their purpose.
I got the following error:
[missions]$ lua missions.lua
lua: ./lib/agent.lua:127: attempt to call global 'setfenv' (a nil value)
stack traceback:
./lib/agent.lua:127: in function 'load_mission'
./lib/agent.lua:212: in function 'run_missions'
missions.lua:29: in main chunk
[C]: in ?
My Lua-version is:
Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio
As pointed out in #10
There is an extra space in test_table_coroutine_contains_six_or_seven_elements function in coroutines.lua. This creates an extra if statement which lua expects to be closed, but which is not closed by an "end"-statement.
FIX: either add another "end"-statement to the function or simply remove the space.
I'm running Arch and the lua
in my path is 5.2.2. When I follow the instructions in the readme file to start the missions,
$ lua missions.lua
I get the following message
lua: ./lib/agent.lua:127: attempt to call global 'setfenv' (a nil value) stack traceback: ./lib/agent.lua:127: in function 'load_mission' ./lib/agent.lua:212: in function 'run_missions' missions.lua:29: in main chunk [C]: in ?
This works fine.
$ lua5.1 missions.lua
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.