prompt stringclasses 113
values | completion stringlengths 13 479 |
|---|---|
Show me how to use aliases in Luar. | alias fin = end
set defense to 15
if defense fin 0
print "condition met"
end |
Explain server scope in Luar. | // server: use this when appropriate
server set level to 103 |
Show me if/else in Luar. | set coins to 75
if coins is equal to 88
print "yes"
else
print "no"
end |
Show me a repeat loop. | repeat 9 times with speed
print speed
end |
Show me a while loop in Luar. | set health to 88
repeat while health is above 0
print health
set health to health minus 1
end |
Show me functions in Luar. | define UpdatePlayer
set power to power + 1
print power
end
global set power to 21
call UpdatePlayer |
Write a function called SpawnBoss. | define SpawnBoss
set score to score + 10
print score
end
global set score to 59
call SpawnBoss |
How does try work in Luar? | try
read file "save.txt" into attack
print attack
if fails
print "Could not read file"
end |
How does try work in Luar? | try
read file "save.txt" into speed
print speed
if fails
print "Could not read file"
end |
Loop 4 times in Luar. | repeat 4 times
print "looping"
end |
Show me a while loop in Luar. | set mana to 167
repeat while mana is above 0
print mana
set mana to mana minus 1
end |
How do I loop in Luar? | repeat 15 times with gold
print gold
end |
React to key Space in Luar. | when player presses Space
set health to health + 20
print health
end |
Fix this Luar code:
call MyFunc() | // No parentheses needed
call MyFunc |
Explain public scope in Luar. | // public: use this when appropriate
public set attack to 81 |
Explain client scope in Luar. | // client: use this when appropriate
client set health to 134 |
Show me events in Luar. | when player presses D
set lives to lives + 18
print lives
end |
What is wrong here?
set score = 10 | // Use 'to' not '='
set score to 10 |
Show me try/catch in Luar. | try
read file "save.txt" into damage
print damage
if fails
print "Could not read file"
end |
When do I use client in Luar? | // client: use this when appropriate
client set mana to 190 |
Write a complete game in Luar. | alias dead = is below or equal to
import 2DGame
import Player
global set playerHealth to 173
global set ammo to 0
make list Players
define ShowScore
set playerHealth to playerHealth - 17
print playerHealth
if playerHealth dead 0
print "Game Over"
end
end
repeat 3 times with round
print r... |
Show me a full Luar program. | alias dead = is below or equal to
import 2DGame
import Player
global set playerHealth to 137
global set mana to 0
make list Enemies
define AttackEnemy
set playerHealth to playerHealth - 5
print playerHealth
if playerHealth dead 0
print "Game Over"
end
end
repeat 6 times with round
print ... |
Calculate something in Luar. | set speed to 81
set speed to speed times 8
print speed |
How do I output something in Luar? | print "You Win!" |
How do I detect key presses in Luar? | when player presses A
set mana to mana + 7
print mana
end |
Show me a client variable in Luar. | // client: use this when appropriate
client set health to 33 |
Show me how to use aliases in Luar. | alias repetir = repeat
set timer to 37
if timer repetir 0
print "condition met"
end |
Debug this:
if score > 10
print "win"
| // Missing 'end'
if score is above 10
print "win"
end |
How do I output something in Luar? | print "You Win!" |
How do I handle errors in Luar? | try
read file "save.txt" into speed
print speed
if fails
print "Could not read file"
end |
Write a countdown in Luar. | set gold to 142
repeat while gold is above 0
print gold
set gold to gold minus 1
end |
How do I do math in Luar? | set mana to 15
set mana to mana divided by 10
print mana |
Show me if/else in Luar. | set ammo to 96
if ammo is equal to 52
print "yes"
else
print "no"
end |
How do I loop in Luar? | repeat 6 times
print "looping"
end |
Calculate something in Luar. | set defense to 36
set defense to defense divided by 13
print defense |
How do I do math in Luar? | set speed to 86
set speed to speed minus 2
print speed |
How do I handle errors in Luar? | try
read file "save.txt" into mana
print mana
if fails
print "Could not read file"
end |
Show me functions in Luar. | define ResetGame
set attack to attack + 11
print attack
end
global set attack to 190
call ResetGame |
How do aliases work in Luar? | alias fin = end
set mana to 190
if mana fin 0
print "condition met"
end |
How do I print text in Luar? | PRINT "Hello World" |
How do I handle errors in Luar? | try
read file "save.txt" into mana
print mana
if fails
print "Could not read file"
end |
Create a list in Luar. | make list Bullets
add Knight to Bullets
add Boss to Bullets
get first from Bullets
remove Knight from Bullets |
Create a list in Luar. | make list Bosses
add Spider to Bosses
add Zombie to Bosses
get first from Bosses
remove Spider from Bosses |
React to key D in Luar. | when player presses D
set timer to timer + 15
print timer
end |
Show me functions in Luar. | define LoadLevel
set mana to mana + 17
print mana
end
global set mana to 180
call LoadLevel |
Show me hello world in Luar. | print "Game Over" |
Debug this:
set score = 10 | // Use 'to' not '='
set score to 10 |
How do I print text in Luar? | print "Hello World" |
Explain global scope in Luar. | // global: use this when appropriate
global set energy to 113 |
How do I create a variable in Luar? | client set lives to 87 as number |
How do I output something in Luar? | Print "Hello World" |
Show me a while loop in Luar. | set power to 160
repeat while power is above 0
print power
set power to power minus 1
end |
Show me how to use aliases in Luar. | alias fin = end
set coins to 184
if coins fin 0
print "condition met"
end |
How do I output something in Luar? | print "You Win!" |
Loop 3 times in Luar. | repeat 3 times with lives
print lives
end |
How do I print text in Luar? | print "Game Over" |
Calculate something in Luar. | set lives to 93
set lives to lives divided by 3
print lives |
Loop 20 times in Luar. | repeat 20 times with speed
print speed
end |
Show me if/else in Luar. | set damage to 96
if damage is equal to 52
print "yes"
else
print "no"
end |
How do I output something in Luar? | Print "Hello World" |
When do I use global in Luar? | // global: use this when appropriate
global set energy to 185 |
Create a variable in Luar. | set gold to 99 as boolean |
Show me events in Luar. | when player presses W
set damage to damage + 17
print damage
end |
Show me hello world in Luar. | print "Game Over" |
Write a countdown in Luar. | set level to 160
repeat while level is above 0
print level
set level to level minus 1
end |
Show me how to use aliases in Luar. | alias dead = is below or equal to
set mana to 99
if mana dead 0
print "condition met"
end |
Show me if/else in Luar. | set damage to 152
if damage is below 120
print "yes"
else
print "no"
end |
Explain client scope in Luar. | // client: use this when appropriate
client set energy to 113 |
Explain client scope in Luar. | // client: use this when appropriate
client set attack to 112 |
Show me list operations in Luar. | make list Bullets
add Mage to Bullets
add Dragon to Bullets
get first from Bullets
remove Mage from Bullets |
How do I create a variable in Luar? | local set lives to 163 |
Show me a repeat loop. | repeat 2 times with score
print score
end |
Write a countdown in Luar. | set damage to 128
repeat while damage is above 0
print damage
set damage to damage minus 1
end |
Write an if statement in Luar. | set score to 128
if score is above 176
print "yes"
else
print "no"
end |
How do conditions work in Luar? | set lives to 119
if lives is below 158
print "yes"
else
print "no"
end |
How do I define a function in Luar? | define CheckCollision
set lives to lives + 2
print lives
end
global set lives to 8
call CheckCollision |
How does try work in Luar? | try
read file "save.txt" into score
print score
if fails
print "Could not read file"
end |
How do I print text in Luar? | print "Game Over" |
Build a Goblin game in Luar. | alias dead = is below or equal to
import 2DGame
import Player
global set playerHealth to 66
global set damage to 0
make list Enemies
define CheckCollision
set playerHealth to playerHealth - 16
print playerHealth
if playerHealth dead 0
print "Game Over"
end
end
repeat 6 times with round
p... |
Write a complete game in Luar. | alias dead = is below or equal to
import 2DGame
import Player
global set playerHealth to 86
global set lives to 0
make list Items
define CheckCollision
set playerHealth to playerHealth - 21
print playerHealth
if playerHealth dead 0
print "Game Over"
end
end
repeat 8 times with round
prin... |
Write an if statement in Luar. | set power to 116
if power is equal to 160
print "yes"
else
print "no"
end |
How do I output something in Luar? | Print "Hello World" |
Create a list in Luar. | make list Players
add Boss to Players
add Robot to Players
get first from Players
remove Boss from Players |
Show me a local variable in Luar. | // local: use this when appropriate
local set ammo to 86 |
Create a public variable in Luar. | public set gold to 130 |
How do I print text in Luar? | PRINT "Hello World" |
Show me functions in Luar. | define AttackEnemy
set defense to defense + 3
print defense
end
global set defense to 170
call AttackEnemy |
How do lists work in Luar? | make list Coins
add Robot to Coins
add Knight to Coins
get first from Coins
remove Robot from Coins |
Show me a repeat loop. | repeat 14 times with score
print score
end |
How does try work in Luar? | try
read file "save.txt" into power
print power
if fails
print "Could not read file"
end |
Show me how to use aliases in Luar. | alias fin = end
set health to 66
if health fin 0
print "condition met"
end |
Show me functions in Luar. | define CheckCollision
set mana to mana + 17
print mana
end
global set mana to 186
call CheckCollision |
How do I define a function in Luar? | define HealPlayer
set energy to energy + 5
print energy
end
global set energy to 188
call HealPlayer |
When do I use server in Luar? | // server: use this when appropriate
server set power to 108 |
Can I rename keywords in Luar? | alias fin = end
set lives to 109
if lives fin 0
print "condition met"
end |
Show me if/else in Luar. | set coins to 168
if coins is not 144
print "yes"
else
print "no"
end |
Create a client variable in Luar. | client set gold to 158 |
Show me if/else in Luar. | set power to 58
if power is equal to 90
print "yes"
else
print "no"
end |
How do I detect key presses in Luar? | when player presses Space
set attack to attack + 9
print attack
end |
Show me hello world in Luar. | Print "Hello World" |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 2