Neatro's Satellite Lua
© 2024 Neatro
--example
PrintClear()
PrintColor('#7F9FFF')
t = {test="test",t={foo='bar',any={h=2,depth={is={possible={wow={}}}}}}} --some table
t.itself = t --table contains a reference to itself
PrintTable(t) --print table!
print('')
print('<C#F00>t</C><C#FF0>e</C><C#0F0>s</C><C#00F>t</C>')
PrintTable(tbl)
function ClassName()
local obj = {}
obj.type = "ClassName";
...
return obj
end
function Person( name, country )
local obj = {}
obj.type = "ClassName";
obj.name = name
obj.country = country
function obj:getName()
return self.name
end
function obj:getCountry()
return self.country
end
return obj
end
local Neatro = Person('Neatro','Netherlands')
return Neatro:getCountry()
if condition then
...
end
for i = 1, 10 do
...
end
for k, v in pairs( tbl ) do
...
end
while condition do
...
end
local Myblock = Voxy6.VoxelRegister( "Voxy:NewBlock" )
Voxy6.VoxelSetAtlassing( "Voxy:NewBlock", Atlas )
Voxy6.VoxelSetVisualStyle( "Voxy:NewBlock" )
local Rock = Voxy6.VoxelRegister( "Voxy:Rock" )
Voxy6.VoxelSetAtlassing( "Voxy:Rock", Voxy6.AtlasRegular( 6, 1 ) )
Voxy6.VoxelSetVisualStyle( "Voxy:Rock" )
Voxy6.VoxelSetVisualStyle( "Voxy:Rock", Voxy6.Geometry.Func, -1, function( quads, id, pos, world, vdata, localNeighbours )
local quadcount = 0
for i = 0, 12 do
local mins = i / 16
local maxs = ( i + 4 ) / 16
quadcount = quadcount + Voxy6.MeshAddCuboidAutoUV( quads, pos, Vector(mins,mins,mins), Vector(maxs,maxs,maxs), vdata )
end
return quadcount
end )
Voxy6.VoxelSetEvent( "Voxy:Rock", "OnUpdate", function( world, id, pos )
world:SetBlock( pos, 0 ) --break when updated
return 1 --update neighbourhood
end )
hook.Add("Test", "first", function() end)
hook.Add("Test", "second", function() end)
hook.Add("Test", "last", function() end)
hook.Add("Test2", "test", function() end)
--Run this little script, then head to the Tools menu -> Hook registry.
--You'll see all your defined hooks!
createWindow( "My window" ):setContent( "This is inside the window" )
--create the window
local testwindow = createWindow( "My window" )
local starttime = os.clock()
--move the window and make it small
testwindow:setBounds( 'calc( 50% + 5px )','29px',0,0 )
--run every tick
hook.Add( "tick", "test", function()
local showtime = os.clock() - starttime
testwindow:setContent(
"Time since started: "..string.format( "%02d", math.floor( showtime / 3600 ) )..
":"..string.format( "%02d", math.floor( showtime / 60 ) )..
":"..string.format( "%05.2f", ( math.floor( ( showtime % 60 ) * 100 ) / 100 ) )
)
end )