Difference between revisions of "What's New in LUA Modding"

From SkyCorp Global
Line 7: Line 7:
 
Previously mod json in AS3:
 
Previously mod json in AS3:
  
<syntaxhighlight lang="json">
+
<syntaxhighlight lang="json" highlight="11">
 
{
 
{
 
"type": "ENTITY",
 
"type": "ENTITY",
Line 24: Line 24:
 
And now mod json:
 
And now mod json:
  
<syntaxhighlight lang="json">
+
<syntaxhighlight lang="json" highlight="11">
 
{
 
{
 
"type": "ENTITY",
 
"type": "ENTITY",

Revision as of 05:08, 18 July 2023

Inputting LUA

You no longer need to manually compile LUA into bytecode and then base64 it! Now you simply escape the lua source code and drop it in.

Note the field changed from 'luac' (compiled lua) to just 'lua'

Example

Previously mod json in AS3:

{
	"type": "ENTITY",
	"name":
	{
		"literalString" : "Shinier Gem"
	},
	"description":
	{
		"programString": true
	},
	"luac": "G0x1YVEAAQQEBAgAEAAAAEBzaGluaWVyR2VtLmx1YQAAAAAAAAAAAAAAAgIDAAAAJAAAAAcAAAAeAIAAAQAAAAQMAAAAZGVzY3JpcHRpb24AAQAAAAAAAAAFAAAADQAAAAAAAAIDAAAAAQAAAB4AAAEeAIAAAQAAAAQyAAAAVGhlIGdlbSBzaGluZXMgcHJvZ3JhbWF0aWNhbGx5IGFzIHlvdSBsb29rIGF0IGl0LgAAAAAAAwAAAAgAAAALAAAADQAAAAEAAAAQAAAAZGVzY3JpcHRpdmVUZXh0AAEAAAACAAAAAAAAAAMAAAANAAAABQAAAA0AAAAAAAAAAAAAAA=="
}

And now mod json:

{
	"type": "ENTITY",
	"name":
	{
		"literalString" : "Shinier Gem"
	},
	"description":
	{
		"programString": true
	},
	"lua": "-- Description is called when an object's description is shown to the\r\n-- player or otherwise requested.  The object should return a string\r\n-- containing the description.\r\n\r\nfunction description()\r\n\r\n   -- Create a descriptive string\r\n   local descriptiveText = \"The gem shines programatically as you look at it.\";\r\n\r\n   -- Return it\r\n   return descriptiveText;\r\n\r\nend"
}

Access to more utility functions/classes