aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/consolecolor.nom10
-rw-r--r--lib/object.nom6
2 files changed, 9 insertions, 7 deletions
diff --git a/lib/consolecolor.nom b/lib/consolecolor.nom
index e0e032d..fe7da4c 100644
--- a/lib/consolecolor.nom
+++ b/lib/consolecolor.nom
@@ -14,8 +14,10 @@ test:
for %name = %colornum in %colors:
%colornum = "\%colornum"
- (=lua "COMPILE_ACTIONS").%name = (..)
+ #(=lua "COMPILE_ACTIONS").%name = (..)
[%nomsu, %tree] -> (Lua value "'\\027[\(%colornum)m'")
- (=lua "COMPILE_ACTIONS")."\%name 1" = (..)
- [%nomsu, %tree, %text] -> (..)
- Lua value "('\\027[\(%colornum)m'..\(%text as lua expr)..'\\027[0m')"
+ (=lua "COMPILE_ACTIONS")."\%name" = (..)
+ [%nomsu, %tree, %text] ->:
+ if %text:
+ return (Lua value "('\\027[\(%colornum)m'..\(%text as lua expr)..'\\027[0m')")
+ ..else: return (Lua value "'\\027[\(%colornum)m'")
diff --git a/lib/object.nom b/lib/object.nom
index 4f45188..d5555df 100644
--- a/lib/object.nom
+++ b/lib/object.nom
@@ -93,13 +93,13 @@ test:
__index=\(%parent as lua expr),
__tostring=function(cls) return cls.name end,
__call=function(cls, inst)
- inst = setmetatable(inst or {}, cls)
+ if inst == nil then return cls end
+ inst = setmetatable(inst, cls)
if inst.set_up then inst:set_up() end
return inst
end,
})
- nomsu.environment[(class.name.." 1"):as_lua_id()] = class
- nomsu.environment[class.name:as_lua_id()] = function() return class end
+ nomsu.environment[class.name:as_lua_id()] = class
class.__index = class
class.class = class
class.__tostring = function(inst)