Share Your Code

GUID Creation Module

Posted by drbigfresh, Posted on February 22, 2012

GitHub URL:

I needed a way to generate unique IDs for something I was working on, and since Corona doesn't have built in support for guids, and since the only other thing out there had dependencies, I wrote my own. I can't say that they adhere entirely to the spec., but they look right, and they're guaranteed to be unique, so it was good enough for me.

They looks like this:




Usage is super simple:

On a normal something.lua page

--Require the module at the top of your page:

local guid = require "guid"

--Then call generate() to make one:


If you're using StoryBoard

In your main.lua:

--Require StoryBoard

local storyboard = require "storyboard"

--Create a table to hold modules:

storyboard.modules = {}

--Add the GUID Module

storyboard.modules.guid = require('guid')

--Then call generate() to make one in any of your scene files:


If you come across any bugs or better ways of doing it, post em over on github and I'll fix/add them.


Ninja Pig Studios
User offline. Last seen 5 weeks 6 days ago. Offline
Joined: 26 Jan 2011

I like this! Really cool, it could be really useful for multiplayer games.

Jordan Schuetz
Ninja Pig Studios

User offline. Last seen 2 weeks 2 hours ago. Offline
Joined: 20 Nov 2010

Epic! Thank you!

User offline. Last seen 6 hours 33 min ago. Offline
Joined: 30 May 2011

Hi, I have been using this but then I was having some strange errors and tracked it back to this module.

I then tested:

for i = 1, 100, 1 do

and after 20 loops it starts returning False.

In line 22 in the module you have:
if(guid.loops > 20) then return false; end
which is the cause of the problem I believe.