Compare commits

...

5 Commits

Author SHA1 Message Date
Éric NICOLAS
4053fe2f6b
Merge 0ef979f937 into f1b0bb5413 2024-10-09 18:03:01 -04:00
Anton P
f1b0bb5413
[d/ru] Update contributor links (#5134)
Some checks failed
Trigger site build / deploy (push) Has been cancelled
CI / lint (push) Has been cancelled
2024-10-06 12:51:00 -04:00
Éric NICOLAS (ccjmne)
0ef979f937
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.
2024-07-04 13:49:47 +02:00
Éric NICOLAS (ccjmne)
d5769cecdd
Fix awkward wording in sample code comments 2024-07-04 13:48:15 +02:00
Éric NICOLAS (ccjmne)
7b5902d723
Remove markdown break in code block 2024-07-04 13:47:34 +02:00
2 changed files with 13 additions and 10 deletions

View File

@ -232,8 +232,8 @@ eatenBy = myFavs.animal -- works! thanks, metatable
-- An __index value can also be a function(tbl, key)
-- for more customized lookups.
-- Values of __index,add, .. are called metamethods.
-- Full list. Here a is a table with the metamethod.
-- The values of __index, __add, etc are called
-- metamethods. Here's their full list:
-- __add(a, b) for a + b
-- __sub(a, b) for a - b
@ -258,7 +258,7 @@ eatenBy = myFavs.animal -- works! thanks, metatable
-- Classes aren't built in; there are different ways
-- to make them using tables and metatables.
-- Explanation for this example is below it.
-- The explanation for this example follows it.
Dog = {} -- 1.
@ -332,9 +332,6 @@ end
--[[ I'm commenting out this section so the rest of
-- this script remains runnable.
```
```lua
-- Suppose the file mod.lua looks like this:
local M = {}
@ -369,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.

View File

@ -2,9 +2,9 @@
language: D
filename: learnd-ru.d
contributors:
- ["Anton Pastukhov", "http://dprogramming.ru/"]
- ["Robert Brights-Gray", "http://lhs-blog.info/"]
- ["Andre Polykanine", "http://oire.me/"]
- ["Anton Pastukhov", "https://anton9.com/"]
- ["Robert Brights-Gray", "https://lhs.su/"]
- ["Andre Polykanine", "https://oire.me/"]
lang: ru-ru
---