X-Ray16 engine bindings documentation and types.
For usage with TypeScriptToLua.
Module contains xray engine globals typedefs for typescript.
By default x-ray export bindings that can be accessed from lua scripts, but without any API documentation.
To check more details / correct typing you always can reference X-Ray source code.
Types documentation can be checked here.
Types are used with xrf template and can be referenced as an example.
C++ classes can be extended in Lua code with 'class' keyword.
Class declaration registers table as userdata and adds constructor/destructor metamethods.
In TS codebase 'LuabindClass' decorator can be used to modify transformation and enable virtual calls.
Separate transformer is needed to build luabind classes instead of table-based classes.
-dump_bindings
flagscriptbindings_*.txt
filesPackage includes plugins for typescript-to-lua for easier work with xray16 typings.
Plugins can be included in tstl tsconfig file as following section:
{
"tstl": {
"luaPlugins": [
{ "name": "xray16/plugins/transform_luabind_class/plugin" },
{ "name": "xray16/plugins/global_declarations_transform" },
{ "name": "xray16/plugins/built_at_info" },
{ "name": "xray16/plugins/strip_lua_logger" },
{ "name": "xray16/plugins/inject_filename" },
{ "name": "xray16/plugins/from_cast_utils" },
{ "name": "xray16/plugins/inject_tracy_zones" }
]
}
}
Arguments for TSTL:
--no-lua-logs
--inject-tracy-zones
Env variables for custom CLI scripts:
XR_NO_LUA_LOGS
XR_INJECT_TRACY_ZONES
Custom plugin overriding transformation of classes marked with @LuaClass
decorator.
Instead of using prototypes and metatables use luabind API to declare such classes.\
Plugin injecting time and generic metadata on top of built lua scripts.
Plugin stripping all the runtime imports from xray16
package.
Default tstl
behaviour does not work well with engine imports and I tried to avoid implicit globals.
Plugin to strip all LuaLogger
calls from runtime if env variable is set or path param is provided.
Logger can consume a lot of processing time that does not benefit player.
Plugin adding $filename
global variable replaced with actual file name on build time.
Lua does not provide convenient API do get filename in runtime and static step is much simpler.
Plugin to simplify casting from LuaTable
to typescript array/map objects.
All the calls are completely gets stripped and removed from runtime.
Plugin designed to work specifically with tracy profiler.
Once it is enabled with env variable or path parameter, tracy zone marking calls are injected for every method.
This way you will be able to build profiling bundle to understand bottlenecks and what takes CPU time.