Infoboxes are being rewritten. You might see images or tabs broken or behaving weirdly during the move. Infoboxes use galleries instead of tabbers now. See the source of Broot for more info.

SNCA:Lua

From Soyjak Wiki, the free ensoyclopedia
Jump to navigationJump to search
>It's from my country ou algo assim.
Literally Lua.

Lua is a lightweight yet high-level programming language made by brapzillian programmer Roberto Ierusalimschy, it's very similar to Python in terms of syntax. Its main purpose is to be embedded in other applications. A fork of Lua, which is Luau, is used as the main scripting language for Roblox.

Its package manager is LuaRocks, it handles the distribution, installation, and management of Lua modules, modules being reusable lines of code.

Lua means "Moon" in Portuguese, hence the logo.

Lua is often embedded into C and C++ programs as a scripting language, and can interact with those C/C++ applications. This is why it is often used as a scripting language in many games.

Unusual aspects[edit | edit source]

  • In Lua, there is no true value, despite there being a false. Instead, any value that is not nil or false is considered true.
  • Lua uses indexes beginning with 1, not 0, even though most languages index beginning with 0.

Example[edit | edit source]

-- seed the random number generator with the current time
math.randomseed(os.time())

-- determines whether the tranny should ack based on a probability
-- ackProbability: number between 0 and 100 representing the chance of acking
-- returns true if the random chance is less than ackProbability, false otherwise
local function shouldAck(ackProbability)
    -- generate a random number between 0 and 100
    local prob = math.random() * 100

    -- clamp the probability to ensure it's between 0 and 100
    ackProbability = math.max(0, math.min(ackProbability, 100))

    -- return true if random number is less than ack probability
    return prob < ackProbability
end
 
-- main function that decides whether to ack or print "TRANS RIGHTS ARE HUMAN RIGHTS!!!!"
local function main()
    if shouldAck(41) then
        print("ACK!!!!")
    else
        print("TRANS RIGHTS ARE HUMAN RIGHTS!!!!!!!!")
    end
end

-- run the main function
main()

Citations

Lua is part of a series on Computing

LOW LEVEL

AssemblyCC++C#Holy CRust

HIGH LEVEL

JavaGoPHPPythonSQLBashJavaScriptPowerShellActionScriptScratchRubyLua

MARKUP

HTMLCSSSVGXML

IMAGEBOARDS

nusoiVichanYotsubaOpenYotsuba

OS

WindowsLinuxAndroidTempleOS

MISC

BabybotMcChallengeSystemdMS PaintJS PaintPhotoshopFlashIRCAd blockingDark Web

AI

ChatGPTGeminiGrokVibe codingGenerative AIStable Diffusion