-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from niroteam/production
First Addition!
- Loading branch information
Showing
20 changed files
with
908 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# הסבר | ||
|
||
בואו נסביר איך להתחיל עם **הַדּוֹקוֹמֶנְטַצְיָה הָעִבְרִית** | ||
|
||
## יודעים לואה? | ||
|
||
מוזמנים לקפוץ **[בואו ללמוד על רובלוקס סטודיו](category/רובלוקס-סטודיו)** | ||
|
||
## מתחילים לגמרי? | ||
|
||
**עברו לדף הבא!** | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# הסבר | ||
|
||
בואו נסביר איך להתחיל עם **הַדּוֹקוֹמֶנְטַצְיָה הָעִבְרִית** | ||
|
||
## יודעים לואה? | ||
|
||
מוזמנים לקפוץ **[בואו ללמוד על רובלוקס סטודיו](category/רובלוקס-סטודיו)** | ||
|
||
## מתחילים לגמרי? | ||
|
||
**עברו לדף הבא!** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"label": "מבוא", | ||
"position": 2, | ||
"link": { | ||
"type": "generated-index", | ||
"description": "מה זה Lua?" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
sidebar_position: 3 | ||
--- | ||
|
||
|
||
# הכרות עם רובלוקס סטודיו | ||
1. **Explorer**: חלון שמראה את כל האובייקטים במשחק בצורת עץ. כאן אפשר למצוא חלקים, מודלים, סקריפטים וכל אובייקט אחר. | ||
![Explorer](https://prod.docsiteassets.roblox.com/assets/studio/general/View-Tab-Explorer.png.webp) | ||
|
||
2. **Properties**: חלון שמציג את כל המאפיינים של האובייקט הנבחר. אפשר לשנות כאן מאפיינים כמו צבע, גודל ומיקום. | ||
![Properties](https://prod.docsiteassets.roblox.com/assets/studio/general/View-Tab-Properties.png.webp) | ||
|
||
3. **Toolbox**: אוסף של מודלים, חלקים וסקריפטים מוכנים לשימוש שאפשר להוסיף למשחק בקלות. | ||
![Toolbox](https://prod.docsiteassets.roblox.com/assets/studio/general/View-Tab-Toolbox.png.webp) | ||
|
||
4. **Script Editor**: עורך טקסט לכתיבת סקריפטים ב-Lua. הוא תומך בהדגשת תחביר, השלמה אוטומטית, וכלי debugging. | ||
|
||
5. **Output**: חלון שמציג הודעות מערכת, שגיאות ולוגים שנוצרים במהלך הרצת הסקריפטים. | ||
![Output](https://prod.docsiteassets.roblox.com/assets/studio/general/View-Tab-Output.png.webp) | ||
|
||
6. **Play Testing**: אפשרות להריץ את המשחק במצב בדיקה בתוך ה-Studio, כדי לבדוק איך המשחק מתנהג בפועל ולבצע תיקונים במידת הצורך. | ||
![Play Testing](https://prod.docsiteassets.roblox.com/assets/education/build-it-play-it-create-and-destroy/pressPlay_cc2019.png.webp) | ||
|
||
7. **Plugins**: תוספים שמאפשרים להרחיב את היכולות של Roblox Studio עם כלים נוספים שפותחו על ידי הקהילה או צוות הפיתוח של Roblox. | ||
![Plugins](https://prod.docsiteassets.roblox.com/assets/studio/general/Toolbar-Plugins-Tab.png.webp) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"label": "יסודות לואה", | ||
"position": 4, | ||
"link": { | ||
"type": "generated-index", | ||
"description": "מה זה Lua?" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
sidebar_position: 4 | ||
--- | ||
|
||
# תנאים | ||
|
||
## מהו תנאי? | ||
|
||
תנאי הוא מבנה שמאפשר לקוד לבדוק אם ביטוי מסוים הוא נכון או לא, ואז לבצע פעולה בהתאם לתוצאה. ב-Roblox Studio, משתמשים בתנאים כדי לקבוע מה יקרה במצבים שונים. | ||
|
||
## שימוש בתנאים | ||
|
||
הנה דוגמה פשוטה לשימוש בתנאים: | ||
|
||
### אם | ||
|
||
התנאי `if` משמש לבדיקה אם ביטוי מסוים הוא נכון (true). אם הוא נכון, הקוד בתוך הבלוק של `if` יבוצע. | ||
|
||
נניח שיש לנו משתנה שמייצג את הסכום בכסף ויש לנו תנאי שבודק אם הסכום גדול מ-100. | ||
|
||
```lua | ||
local money = 150 | ||
|
||
if money > 100 then | ||
print("יש לך מספיק כסף לקנות את המוצר!") | ||
end | ||
``` | ||
|
||
### אם אחרת | ||
|
||
התנאי `if-else` משמש כאשר רוצים לבצע פעולה אחת אם הביטוי נכון ופעולה אחרת אם הוא לא נכון. | ||
|
||
נניח שיש לנו משתנה שמייצג את הסכום בכסף ויש לנו תנאי שבודק אם הסכום גדול מ-100. | ||
|
||
```lua | ||
local money = 80 | ||
|
||
if money > 100 then | ||
print("יש לך מספיק כסף לקנות את המוצר!") | ||
else | ||
print("אין לך מספיק כסף לקנות את המוצר.") | ||
end | ||
``` | ||
|
||
### אם אם-אחרת אחרת | ||
|
||
התנאי `if-elseif-else` משמש כאשר יש כמה תנאים לבדוק. רק בלוק אחד יבוצע בהתאם לתנאי הראשון שהוא נכון. | ||
|
||
נניח שיש לנו משתנה שמייצג את הסכום בכסף ויש לנו תנאים שבודקים את הטווחים השונים של הסכום. | ||
|
||
```lua | ||
local money = 50 | ||
|
||
if money > 100 then | ||
print("יש לך מספיק כסף לקנות את המוצר היקר.") | ||
elseif money > 50 then | ||
print("יש לך מספיק כסף לקנות את המוצר הזול.") | ||
else | ||
print("אין לך מספיק כסף לקנות אף מוצר.") | ||
end | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
sidebar_position: 9 | ||
--- | ||
|
||
# טיפול בשגיאות | ||
|
||
## מהי שגיאה? | ||
|
||
שגיאה היא מצב שבו הקוד נתקל בבעיה שאינה מאפשרת לו להמשיך לפעול כראוי. טיפול בשגיאות מאפשר לתוכנית להתמודד עם מצבים כאלה בצורה מסודרת ולמנוע קריסה של התוכנית. | ||
|
||
## שימוש ב-pcall | ||
|
||
ב-Roblox Studio, ניתן להשתמש בפונקציה `pcall` (Protected Call) כדי לטפל בשגיאות. הפונקציה `pcall` מריצה פונקציה אחרת ומחזירה ערך בוליאני המציין אם הפעולה הצליחה או נכשלה. | ||
|
||
### דוגמה - ברווזים | ||
|
||
נניח שיש לנו פונקציה שמדפיסה את שם הברווז, אבל לפעמים השם עלול להיות `nil` (לא קיים): | ||
|
||
```lua | ||
function printDuckName(duck) | ||
if duck.name then | ||
print("שם הברווז הוא " .. duck.name) | ||
else | ||
error("השם של הברווז לא קיים!") | ||
end | ||
end | ||
|
||
local dannyDuck = {name = "דני"} | ||
local unknownDuck = {} | ||
|
||
-- ננסה להדפיס את השם של הברווזים | ||
local success, message = pcall(printDuckName, dannyDuck) | ||
if not success then | ||
print("שגיאה: " .. message) | ||
end | ||
|
||
success, message = pcall(printDuckName, unknownDuck) | ||
if not success then | ||
print("שגיאה: " .. message) | ||
end | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--- | ||
sidebar_position: 6 | ||
--- | ||
|
||
# פעולות | ||
## מהי פעולה? | ||
|
||
פעולה (Function) היא קטע קוד שניתן לקרוא לו לבצע משימה מסוימת. פעולות משמשות לארגון הקוד בצורה נוחה, כדי להימנע מחזרה על אותו קטע קוד במקומות שונים ולהפוך את הקוד לקל יותר להבנה ולתחזוקה. | ||
|
||
## יצירת פעולה | ||
|
||
כדי ליצור פעולה ב-Roblox Studio, משתמשים במילת המפתח `function` ולאחר מכן שם הפעולה. לדוגמה, ניצור פעולה שמדפיסה הודעה על ברווז: | ||
|
||
```lua | ||
function sayHelloDuck() | ||
print("שלום, אני ברווז!") | ||
end | ||
``` | ||
|
||
כדי להפעיל את הפעולה, פשוט נקרא לה לפי השם שלה: | ||
|
||
```lua | ||
sayHelloDuck() -- ידפיס "שלום, אני ברווז!" | ||
``` | ||
|
||
## פעולות עם פרמטרים | ||
|
||
לעיתים נרצה שפעולה תקבל מידע כלשהו כדי לבצע את המשימה שלה. לדוגמה, ניצור פעולה שמדפיסה את השם של הברווז: | ||
|
||
```lua | ||
function greetDuck(duckName) | ||
print("שלום, אני " .. duckName .. " הברווז!") | ||
end | ||
``` | ||
|
||
כדי להפעיל את הפעולה עם שם ברווז מסוים: | ||
|
||
```lua | ||
greetDuck("דני") -- ידפיס "שלום, אני דני הברווז!" | ||
``` | ||
|
||
## פעולות שמחזירות ערך | ||
|
||
פעולה יכולה גם להחזיר ערך באמצעות מילת המפתח `return`. לדוגמה, ניצור פעולה שמחשבת את מספר הכנפיים של מספר ברווזים: | ||
|
||
```lua | ||
function calculateWings(numberOfDucks) | ||
local wings = numberOfDucks * 2 | ||
return wings | ||
end | ||
``` | ||
|
||
כדי להשתמש בפעולה ולהדפיס את מספר הכנפיים של 3 ברווזים: | ||
|
||
```lua | ||
local wingsOfThreeDucks = calculateWings(3) | ||
print("לשלושה ברווזים יש " .. wingsOfThreeDucks .. " כנפיים.") -- ידפיס "לשלושה ברווזים יש 6 כנפיים." | ||
``` | ||
|
||
## פעולות מורכבות | ||
|
||
ניתן לשלב מספר פעולות כדי לבצע משימות מורכבות יותר. לדוגמה, ניצור פעולה שבודקת אם לברווז יש כנפיים ואם כן, מדפיסה הודעה מתאימה: | ||
|
||
```lua | ||
function hasWings(duck) | ||
return duck.wings > 0 | ||
end | ||
|
||
function describeDuck(duck) | ||
if hasWings(duck) then | ||
print(duck.name .. " הוא ברווז עם כנפיים.") | ||
else | ||
print(duck.name .. " הוא ברווז ללא כנפיים.") | ||
end | ||
end | ||
|
||
local dannyDuck = {name = "דני", wings = 2} | ||
describeDuck(dannyDuck) -- ידפיס "דני הוא ברווז עם כנפיים." | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
sidebar_position: 5 | ||
--- | ||
|
||
# לולאות | ||
|
||
## לולאת for | ||
|
||
לולאת `for` משמשת לביצוע קוד מספר פעמים מוגדר. | ||
|
||
```lua | ||
for i = 1, 5 do | ||
print("זהו סבב מספר " .. i) | ||
end | ||
``` | ||
|
||
## לולאת while | ||
|
||
לולאת `while` מבצעת קוד כל עוד תנאי מסוים הוא נכון (true). | ||
|
||
```lua | ||
local count = 1 | ||
while count <= 5 do | ||
print("זהו סבב מספר " .. count) | ||
count = count + 1 | ||
end | ||
``` | ||
|
||
## לולאת repeat | ||
|
||
לולאת `repeat` דומה ל-`while`, אך התנאי נבדק בסוף כל סבב, מה שמבטיח שהלולאה תבוצע לפחות פעם אחת. | ||
|
||
```lua | ||
local count = 1 | ||
repeat | ||
print("זהו סבב מספר " .. count) | ||
count = count + 1 | ||
until count > 5 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
sidebar_position: 8 | ||
--- | ||
|
||
# מודולים | ||
|
||
## מהו מודול? | ||
|
||
מודול הוא קובץ Lua שמכיל קוד שניתן לייבא ולהשתמש בו בקבצים אחרים. מודולים מאפשרים לארגן את הקוד בצורה נוחה ולחלק אותו לחלקים קטנים שניתן לעשות בהם שימוש חוזר. | ||
|
||
## יצירת מודול | ||
|
||
ניצור מודול שמכיל פונקציה פשוטה. קודם כל, ניצור קובץ חדש ונקרא לו `DuckModule.lua`. | ||
|
||
בתוך הקובץ נכתוב את הקוד הבא: | ||
|
||
```lua | ||
local DuckModule = {} | ||
|
||
function DuckModule.quack() | ||
print("קוואק! אני ברווז!") | ||
end | ||
|
||
return DuckModule | ||
``` | ||
|
||
## שימוש במודול | ||
|
||
כדי להשתמש במודול שיצרנו, נייבא אותו בקובץ אחר באמצעות `require`. | ||
|
||
```lua | ||
local DuckModule = require(game.ServerScriptService.DuckModule) | ||
|
||
DuckModule.quack() -- ידפיס "קוואק! אני ברווז!" | ||
``` |
Oops, something went wrong.