This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local blarg = require("blarg") | |
local myblarg = blarg:new() | |
local mintest = myblarg:minimum(1, 6) | |
local maxtest = myblarg:maximum(6, 6) | |
local default = myblarg:toDefault(7) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Blarg = {} | |
local Blarg_mt = {__index = Blarg} | |
function Blarg:new() | |
local self = {} | |
setmetatable( self, Blarg_mt ) | |
self.default = 5 | |
return self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--some examples of Lua tables | |
--initialize table. very similar to Perl | |
local mytable = {} | |
--insert element into table | |
--Using the insert call appends elements to the end starting at index 1 | |
table.insert(mytable, "Hello") | |
table.insert(mytable, "World") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Lua is a dynamically typed language | |
local mystring = "Hello World!" --hello! I'm a string | |
print(mystring) | |
--output: Hello World! | |
mystring = 4.5 --now I'm a float! | |
print(mystring) | |
--output: 4.5 |