Entity Tutorial 3: Random Script

From SkyCorp Global
Revision as of 05:12, 21 December 2017 by SkyCorp (talk | contribs)

Previously we created a gem that would display a description using LUA. Since we're using LUA to power the description, this allows us to do more than just return the same thing every time.

In this tutorial, we'll extend our test gem to reflect a different color of light each time the user looks at it.

LUA Code

The code is extended as follows -- take a read through the comments.

CODE

JSON Definition

After luac'ing and base64'ing the program, we get some base64 luac code which the JSON can be updated with:

JSON

Running

Now each time the gem is looked at, a different color is returned (well, up to three colors anyway).