CraftStudio Wiki
CraftStudio Wiki

When contributing or editing example code in the Wiki, you should follow the standards set fourth below. Most of these standards have been taken from existing examples written by the creator.

  • Use spaces instead of tabs
  • A tab should equal four spaces
  • Pad parenthesized expressions with spaces
if CraftStudio.Input.IsButtonDown( "Fire" ) then
-- and not
if CraftStudio.Input.IsButtonDown("Fire") then
  • There should be no space before a parenthesized expression
if CraftStudio.Input.IsButtonDown( "Fire" ) then
-- and not
if CraftStudio.Input.IsButtonDown ( "Fire" ) then
  • It's suggested that all isolated code samples should be inside of a behavior function. Use Awake as the default if you're not sure which to use
function Behavior:Awake()
     print ("Hello world!")
end

-- and not just...
print ("Hello world!")