1. Lua / Говнокод #9627

    −87

    1. 1
    2. 2
    3. 3
    4. 4
    Splash = playGrayscaleSplashFx
    
    playGrayscaleSplashFx = function()
    end

    Хороший, годный аналог #define true false.
    Обнаружен в Lua-скрипте, автоматически включающемся во все скриптовые контексты (примерный аналог precompiled header).

    playGrayscaleSplashFx - функция, экспортируемая в Lua из C++ кода.

    Внёс в неё изменения, попытался протестировать результат... долго думал.

    Kirinyale, 07 Марта 2012

    Комментарии (31)
  2. Lua / Говнокод #8651

    −340

    1. 1
    2. 2
    -- All scripts should begin at line
    null, Null, NULL = nil

    Lua

    istem, 26 Ноября 2011

    Комментарии (181)
  3. Lua / Говнокод #7584

    −86

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if ( (world:isSelectionMode() or (world:getEffectSizeIcoLua() == 1) or
       (world:getEffectSizeIcoLua() == -1)) and (world:getEffectSizeIcoLua() ~= 2) ) 
    then
    ...
    end

    Скрипт на Lua, доставшийся в наследство. Несмотря на непонятное условие, вся грусть в том, что все значения скрипт получает с движка, и что это за значения нет ни одного комента... '-(

    MAGnit, 18 Августа 2011

    Комментарии (24)
  4. Lua / Говнокод #7297

    −96

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    function onUpdate(this)
    			
    	local  a;
    
    	a = math.floor( math.random() * 1000);
    
    	if(a==68)then
    		playParticleFx(this,"/particles/spider/spider_lift.psysl",10);
    		--logWarning("spirder1");
    	end
    
    	if(a==35)then
    		playParticleFx(this,"/particles/spider/spider_lift_1.psysl",10);
    		--logWarning("spirder2");
    	end
    
    	if(a==73)then
    		playParticleFx(this,"/particles/spider/spider_lift_2.psysl",10);
    		--logWarning("spirder3");
    	end
    
    end;

    Выдержка из Lua-скрипта.
    Выпускаем побегать декоративного паучка по случайными интервалам времени.

    Kirinyale, 20 Июля 2011

    Комментарии (22)
  5. Lua / Говнокод #7195

    −92

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    -- async IO operations
    -- op1.asyncRun(cb) - execute op1, and call cb(op1_result) after op1 completion
    
    -- op1 * g - new async operation which will execute op1.asyncRun(), then execute g(op1_result).asyncRun() and return op2_result
    -- op1 .. op2 - the same, but ignore result of op1. Will execute op1.asyncRun(), then op2.asyncRun() and return op2_result
    private.binder = {
    __mul =
            function(op1, g)
                local op = {
                    asyncRun =
                        function(cb)
                            op1.asyncRun(
                                function(op1_result)
                                    g(op1_result).asyncRun(cb)
                                end
                            )
                        end
                }
                setmetatable(op, private.binder)
                return op
            end,
    
    __concat =
            function(op1, op2)
                 return op1 * function(op1_result) return op2 end
            end,
    
    __metatable = 1
    }
    
    -- примеры использования:
    -- (Chatter.IO.Log("tic") .. Chatter.IO.Sleep(1000) .. Chatter.IO.Log("tac") .. Chatter.IO.Sleep(1000) .. Chatter.IO.Log("toe")).asyncRun(function() end)
    -- (Chatter.IO.GetTime * Chatter.IO.Log .. Chatter.IO.Sleep(1000) .. Chatter.IO.GetTime * Chatter.IO.Log).asyncRun(function() end)

    Lua.

    burdakovd, 07 Июля 2011

    Комментарии (5)
  6. Lua / Говнокод #6809

    −93

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    --загрузка шрифта
    MyFont = pge.font.load("verdana.ttf",12)
    
    --цвета шрифта
    white = pge.gfx.createcolor(255,255,255)
    green = pge.gfx.createcolor(0,255,0)
    
    --загрузка графики
    A01 = pge.texture.load("pics/A-01.png")
    A02 = pge.texture.load("pics/A-02.png")
    A03 = pge.texture.load("pics/A-03.png")
    A04 = pge.texture.load("pics/A-04.png")
    A05 = pge.texture.load("pics/A-05.png")
    A06 = pge.texture.load("pics/A-06.png")
    A07 = pge.texture.load("pics/A-07.png")
    A08 = pge.texture.load("pics/A-08.png")
    A09 = pge.texture.load("pics/A-09.png")
    A10 = pge.texture.load("pics/A-10.png")
    A11 = pge.texture.load("pics/A-11.png")
    A12 = pge.texture.load("pics/A-12.png")
    A13 = pge.texture.load("pics/A-13.png")
    A14 = pge.texture.load("pics/A-14.png")
    A15 = pge.texture.load("pics/A-15.png")
    A16 = pge.texture.load("pics/A-16.png")
    A17 = pge.texture.load("pics/A-17.png")
    A18 = pge.texture.load("pics/A-18.png")
    A19 = pge.texture.load("pics/A-19.png")
    A20 = pge.texture.load("pics/A-20.png")
    A21 = pge.texture.load("pics/A-21.png")
    A22 = pge.texture.load("pics/A-22.png")
    A23 = pge.texture.load("pics/A-23.png")
    A24 = pge.texture.load("pics/A-24.png")
    
    --переменная для счётчика
    index = 1
    
    
    while pge.running() do
    pge.controls.update()
    pge.gfx.startdrawing() -- начало рисования
    pge.gfx.clearscreen() -- очистка экрана
    if pge.controls.pressed(PGE_CTRL_DOWN) then
    index = index+1 -- увеличиваем index на 1
    end
    
    A01:activate()
    A01:draw(30,25) -- отрисовка первой картинки
    -- далее отрисовка последующих картинок в зависимости от значения переменной index
    	if index==2 then
    		pge.gfx.clearscreen()
    		A02:activate()
    		A02:draw(30,25)
    	end
    	if index==3 then
    		pge.gfx.clearscreen()
    		A03:activate()
    		A03:draw(30,25)
    	end
    	if index==4 then
    		pge.gfx.clearscreen()
    		A04:activate()
    		A04:draw(30,25)
    	end
    	if index==5 then
    		pge.gfx.clearscreen()
    		A05:activate()
    		A05:draw(30,25)
    	end
    	if index==6 then
    		pge.gfx.clearscreen()
    		A06:activate()
    		A06:draw(30,25)
    	end
    
    pge.gfx.enddrawing() -- конец отрисовки
    pge.gfx.swapbuffers()
    	if pge.controls.pressed(PGE_CTRL_START) then
    		break
    	end
    end

    Увидел и не смог не запостить
    Lua

    Werdn, 01 Июня 2011

    Комментарии (16)
  7. Lua / Говнокод #6746

    −85

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    require "android"
    local inp = android.getInput("Factorial", "Enter number:")
    local cur = 0
    local sum = 1
    
    repeat
    cur = cur + 1
    sum = sum * cur
    until cur == (inp.result * 1)
    
    android.makeToast("Factorial of " .. inp.result .. " is " .. sum)

    Lua. Маленький скриптик "факториал", накиданный на моём Desire Z в SL4A.
    Как-то явно не так надо строковые типы к целочисленным приводить...

    RaZeR, 24 Мая 2011

    Комментарии (67)
  8. Lua / Говнокод #6337

    −82

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    function repair_clock_Contact(objGame, mVal, sVal) -- master, slave
      -- vsyakie daNNue
      local mType = string.sub (tostring (mVal), -1, -1);
      local mi, mj = repair_clock_GetElemPos(objGame, mVal);
      local sType = string.sub (tostring (sVal), -1, -1);
      local si, sj = repair_clock_GetElemPos(objGame, sVal);
      --?????NEKYUiNYAvKVADRATE???????
    --  if (tonumber (mType) == 2) then   -- FOR MEHA TEST
    --    local a = 0;
    --  end
      if (tonumber (mType) == 9) then
        mType = 2;
      end
      --??????????????????????????????
      --!!!!!NEKYUiNYA!!!!!
      mType = 6 - mType;
      sType = 6 - sType;
      --!!!!!!!!!!!!!!!!!!
      --------------------
    
    ..........................

    Коменты жгут)))
    язык Lua

    MAGnit, 13 Апреля 2011

    Комментарии (21)
  9. Lua / Говнокод #4220

    −79

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    ga = {} --gay/pure lua style
    GA = ga --1337 men style
    GlobalAdmin = ga --Java style
    GlObAlAdMiN = ga --xxx asked :D
    globalAdmin = ga --C style
    globaladmin = ga --other plain lua style

    Долго не могли решить как назвать глобальную таблицу в lua... лучшего решения не нашли.

    Alexsey, 10 Сентября 2010

    Комментарии (61)