diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2017-10-19 17:00:10 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2017-10-19 17:00:10 -0700 |
| commit | b98059261c173dab8d919e7f9a93d44c5de0329d (patch) | |
| tree | b7fdbfe9c746dc2f52a25e0dd2715c769a371d8c /examples/how_do_i.nom | |
| parent | 443f8c73bb67e2fb085c5595add10b98f4696805 (diff) | |
Abbreviated "lua code" to "lua>" and "lua expr" to "=lua" and "lua
block" to "lua do>"
Diffstat (limited to 'examples/how_do_i.nom')
| -rw-r--r-- | examples/how_do_i.nom | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/how_do_i.nom b/examples/how_do_i.nom index 2365627..78a11e2 100644 --- a/examples/how_do_i.nom +++ b/examples/how_do_i.nom @@ -246,17 +246,17 @@ say both (..) # Macros: -# The "lua block %" and "lua expr %" macros can be used to write raw lua code: +# The "lua> %" and "=lua %" macros can be used to write raw lua code: rule [say the time] =: - lua block ".." + lua> ".." |nomsu:writeln("The OS time is: "..os.time()); say the time -say "Math expression result is: \(lua expr "(1 + 2*3 + 3*4)^2")" +say "Math expression result is: \(=lua "(1 + 2*3 + 3*4)^2")" #.. In the lua environment, "vars" can be used to get local variables/function args, and "nomsu" can be used to access the compiler, function defs, and other things rule [square root of %n] =: - lua expr "math.sqrt(vars.n)" + =lua "math.sqrt(vars.n)" say "The square root of 2 is \(square root of 2)" # Macros can be defined to transform one bit of nomsu code into another using "parse % as %": |
