aboutsummaryrefslogtreecommitdiff
path: root/examples/sample_game.nom
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2017-10-19 17:00:10 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2017-10-19 17:00:10 -0700
commitb98059261c173dab8d919e7f9a93d44c5de0329d (patch)
treeb7fdbfe9c746dc2f52a25e0dd2715c769a371d8c /examples/sample_game.nom
parent443f8c73bb67e2fb085c5595add10b98f4696805 (diff)
Abbreviated "lua code" to "lua>" and "lua expr" to "=lua" and "lua
block" to "lua do>"
Diffstat (limited to 'examples/sample_game.nom')
-rw-r--r--examples/sample_game.nom14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/sample_game.nom b/examples/sample_game.nom
index a6a792d..d740655 100644
--- a/examples/sample_game.nom
+++ b/examples/sample_game.nom
@@ -6,15 +6,15 @@ require "lib/plurals.nom"
# Users:
with secrets:
secret %users = (..)
- lua expr ".."
+ =lua ".."
|setmetatable({}, {__index={
| by_name=function(self, key) return "User<"..key..">"; end,
| add=function(self, key) self[key] = self:by_name(key); end,
|}})
rule [find user %name, @%name] =:
- lua expr "secrets.users:by_name(vars.name) or nomsu:error('Failed to find user: '..tostring(vars.name))"
+ =lua "secrets.users:by_name(vars.name) or nomsu:error('Failed to find user: '..tostring(vars.name))"
rule [add user %name] =:
- lua expr "secrets.users:add(vars.name)"
+ =lua "secrets.users:add(vars.name)"
rule [everybody, everyone] =:
(%entry's "key") for %entry in (entries in (secret %users))
@@ -23,7 +23,7 @@ with secrets:
# Inventory:
with secrets:
secret %inventory = (..)
- lua expr ".."
+ =lua ".."
|setmetatable({}, {__index=function(self,key)
| local t = setmetatable({}, {__index=function() return 0; end});
| self[key] = t;
@@ -69,14 +69,14 @@ with secrets:
"inventory", "%'s inventory", "%'s stock of %", "%'s stock of % as str"
rule [you] =:
- lua expr "(nomsu.you or 'Anonymous')"
+ =lua "(nomsu.you or 'Anonymous')"
rule [make %person %action, make %person do %action] =:
- lua code ".."
+ lua> ".."
|local old_you = nomsu.you
|nomsu.you = vars.person
do %action
- lua code ".."
+ lua> ".."
|nomsu.you = old_you
say "===================================================="