From 9867253a28c7f5b547295c85049d1b24f0208569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20NICOLAS?= Date: Thu, 4 Jul 2024 13:49:47 +0200 Subject: [PATCH] Fix sample code At a later point, this guide assumes that the return value of mod2.lua is a function. This commit sets that up so it all makes sense. --- lua.html.markdown | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua.html.markdown b/lua.html.markdown index 01ab29b7..aad207fc 100644 --- a/lua.html.markdown +++ b/lua.html.markdown @@ -366,7 +366,13 @@ mod.sayMyName() -- error -- require's return values are cached so a file is -- run at most once, even when require'd many times. --- Suppose mod2.lua contains "print('Hi!')". +-- Suppose another file, mod2.lua, containing this: +print('Hi!') +return function () + return 'foo' +end + +-- local a = require('mod2') -- Prints Hi! local b = require('mod2') -- Doesn't print; a=b.