aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-07-24 14:07:25 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-07-24 14:07:25 -0700
commit3cf97066be82a3a3405246b7c915bac8773e6004 (patch)
tree0cfab1b647b5ba36156e1ce1c2a707a99f7d469f
parent723eb9e1f169fb2d1b19d53f48fe542edd7fc510 (diff)
Cleaning up code to make use of newer API.
-rw-r--r--lib/object.nom8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/object.nom b/lib/object.nom
index 4ed9bcd..4b144c8 100644
--- a/lib/object.nom
+++ b/lib/object.nom
@@ -45,9 +45,7 @@ test:
compile [@, me] to (Lua value "self")
compile [method %actions %body] to:
- %lua = (compile as (action %actions %body))
- add free vars ((% as lua id) for % in %actions) to %lua
- declare locals in %lua
+ %lua = (compile as (local action %actions %body))
for % in %actions:
to %lua write "\nclass.\(% as lua id) = \(% as lua id)"
return (..)
@@ -90,7 +88,9 @@ compile [object %classname extends %parent %class_body] to (..)
\(%class_body as lua statements)
- class.__tostring = class["A"..string.as_lua_id("as text")]
+ class.__tostring = class["A"..string.as_lua_id("as text")] or function(inst)
+ return inst.name..getmetatable(dict{}).__tostring(inst)
+ end
end
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~