diff --git a/examples/lfloat2bytes.pd_lua b/examples/lfloat2bytes.pd_lua
index 7dc8480b1e038fab0af3651382c403012c53f7ae..22a2767ae1d459d47f3f050ab8e6792c8dadb06b 100644
--- a/examples/lfloat2bytes.pd_lua
+++ b/examples/lfloat2bytes.pd_lua
@@ -19,7 +19,7 @@ function lfloat2bytes:initialize(name, atoms)
     if (type(atoms[1]) ~= "number") then
       self:error("lfloat2bytes: Digit count not a number")
     elseif (atoms[1] > 0) and (atoms[1] <= 24) then
-      digitstr = "%0." .. atoms[1] .. "g"
+      digitstr = string.format("%%0.%dg", atoms[1])
     else
       self:error("lfloat2bytes: Digit count out of range")
     end