wiki.sine.space | sinespace

Difference between revisions of "Scripting/LUA"

From wiki.sine.space
Jump to: navigation, search
(Notes on the Lua implementation)
Line 1: Line 1:
 
Space supports two separate scripting runtimes - Lua and C#; for most uses, we strongly recommending using the Lua variant, as it is cross-platform compatible. (C#/.NET only work for Standalone clients). Our Lua runtime runs optimally in all platforms including WebGL; and utilises the same API as the C# variant.
 
Space supports two separate scripting runtimes - Lua and C#; for most uses, we strongly recommending using the Lua variant, as it is cross-platform compatible. (C#/.NET only work for Standalone clients). Our Lua runtime runs optimally in all platforms including WebGL; and utilises the same API as the C# variant.
 +
 +
'''Note: We had originally announced JavaScript as our cross-platform runtime, however after implementation we've found our Lua runtime performs considerably better and with greater stability.'''
  
 
==Notes on the Lua implementation==
 
==Notes on the Lua implementation==

Revision as of 12:08, 17 January 2017

Space supports two separate scripting runtimes - Lua and C#; for most uses, we strongly recommending using the Lua variant, as it is cross-platform compatible. (C#/.NET only work for Standalone clients). Our Lua runtime runs optimally in all platforms including WebGL; and utilises the same API as the C# variant.

Note: We had originally announced JavaScript as our cross-platform runtime, however after implementation we've found our Lua runtime performs considerably better and with greater stability.

Notes on the Lua implementation

  • We do not place many limits on scripts, however scripts must return execution context every 5000 (configurable) instruction cycles (scripts are run in a deterministic single-threaded manner for compatibility with HTML5/WebGL where threading does not yet exist)
  • Using coroutines or binding to a regularly firing event (e.g. OnUpdate()) is a way of continuing a long running script.
  • Scripts run in the client (for server scripts see Scripting/Server Scripts)