
function string:split(delimiter)
  local result = { }
  local from  = 1
  local delim_from, delim_to = string.find( self, delimiter, from  )
  while delim_from do
    table.insert( result, string.sub( self, from , delim_from-1 ) )
    from  = delim_to + 1
    delim_from, delim_to = string.find( self, delimiter, from  )
  end
  table.insert( result, string.sub( self, from  ) )
  return result
end

function string:trim()
  return (string.gsub(self, "^%s*(.-)%s*$", "%1"))
end

function global(name, value)
  _G[name] = value
end

----------------------------------------------------------------------------------------
-- Functions async. 

-- Sound
function PlaySound(sound)
  Audio:Play(sound)
end

function PlayMusic(music, fadeIn, fadeOut)
  Audio:OpenPlaylist(music)
  Audio:PlayMusic(music,-1, fadeIn, fadeOut)
end
----------------------------------------------------------------------------------------
