# LUA code patch for - Forest - Forest Miners - posted intro/ overview / and default code

**URL:** <https://discourse.codecombat.com/t/lua-code-patch-for-forest-forest-miners-posted-intro-overview-and-default-code/9423>\
**Category:** Artisan\
**Created:** [October 22, 2016, 1:33am UTC](https://discourse.codecombat.com/t/lua-code-patch-for-forest-forest-miners-posted-intro-overview-and-default-code/9423 "2016-10-22T01:33:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harry\_the\_Wanderer](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/harry_the_wanderer/32/5369_2.png) [@Harry\_the\_Wanderer](https://discourse.codecombat.com/u/Harry_the_Wanderer)\
**Post date:** [October 22, 2016, 1:33am UTC](https://discourse.codecombat.com/t/lua-code-patch-for-forest-forest-miners-posted-intro-overview-and-default-code/9423/1 "2016-10-22T01:33:13Z")

</div>

**_Default code for LUA - - Copy-Paste into the editor to start_**

* * *

```python
-- Check if the mines are safe for the workers.

local checkEnemyOrSafe = function(target)
    -- If target (the parameter) exists:
    
        -- Then attack target.
        
    -- Otherwise use say() to call the peasants.
    
end

while true do
    -- Move to, and check the top right X mark.
    hero:moveXY(64, 54)
    local enemy = hero:findNearestEnemy()
    checkEnemyOrSafe(enemy)

    -- Move to the bottom left X mark.
    
    -- Save the result of findNearestEnemy() in a variable.
    
    -- Call checkEnemyOrSafe(), and pass the
    -- result of findNearestEnemy as the argument.
    
end

```

* * *

_ **Please feel free to use this to help you with the level until the patch is applied.** _
