SNCA:Lua
From Soyjak Wiki, the free ensoyclopedia
Jump to navigationJump to search

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. It's also used as the main scripting language for Roblox. Ev&doe it's LuaU.
Its package manager is LuaRocks, it handles the distribution, installation, and management of Lua modules, modules being reusable lines of code.
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()
|
Lua is part of a series on Computer Science. |
|
|---|---|
| Languages | Low Level Assembly • C • C++ • C# • Holy C • Rust High Level Java • Go • PHP • Python • SQL • Bash • JavaScript • PowerShell • ActionScript • Scratch • Ruby • Lua |
| Software | Imageboards nusoi • Vichan • Yotsuba • OpenYotsuba OSes Windows • Linux • Android • TempleOS |
| More | SoyGNU • CGI • DDoS • Vibe coding • Game development • Piracy • Regex • Doxing • Microsoft • Apple • Google • Datamining • WebP • Artificial soyduel • Ratio dueling • Customization • Ricing • FSL • Windows debloating |