From 1ce198bcffddaf3273daefe1961e3a689b2acb6e Mon Sep 17 00:00:00 2001 From: Adrian Mariano Date: Sat, 2 Jan 2021 23:28:11 -0500 Subject: [PATCH] Added no_function and no_module --- common.scad | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/common.scad b/common.scad index d1d4021..865a580 100644 --- a/common.scad +++ b/common.scad @@ -446,6 +446,26 @@ module no_children(count) { assert(count==0, str("Module ",parent_module(1),"() does not support child modules")); } +// Function: no_function() +// Usage: +// dummy = no_function(name) +// Description: +// Asserts that the function, "name", only exists as a module. +// Example: +// +function no_function(name) = + assert(false,str("You called ",name,"() as a function, but it is available only as a module")); + + +// Module: no_module() +// Usage: +// no_module(); +// Description: +// Asserts that the called module exists only as a function. +module no_module() { + assert(false, str("You called ",parent_module(1),"() as a module but it is available only as a function")); +} + // Section: Testing Helpers