Carbide

(in ./Carbon/Carbide.lua)

Implements a set of Lua language extensions known as Carbide.

This file is related to the Carbide programmatic API, for details on using Carbide, see Using Carbide.


Methods

class public Carbide.Compile(string source, [string chunkname, table environment, table settings])

Returns function

  • required source: The Carbide source.
  • optional chunkname: The name of the chunk for Lua errors.
  • optional environment: The environment to compile the chunk with.
  • optional settings: The settings to compile Carbide with.

Parses and compiles the given Carbide source. A drop-in replacement for Carbon.LoadString.


class public Carbide.Parse(string source, [table settings])

Returns function

  • required source: The Carbide source.
  • optional settings: The settings to compile Carbide with.

Parses the given Carbide source.


class public Carbide.ParseCore(string source, [table settings])

Returns string

  • required source: The source to parse.
  • optional settings: Settings (source directives) to pass to the parser

Parses the given source for Carbide expressions.

The source can change the feature level with #CARBIDE_FEATURE_LEVEL <level>, which defaults to 2.


class public Carbide.ParseTemplated(string source, [table settings])

Returns string

  • required source: The source to parse for templates.
  • optional settings: Settings (source directives) to use when parsing the templates.

Parses the source file for templates if it contains a #TEMPLATES_ENABLED directive.

The document can change the templating level using #TEMPLATE_LEVEL <level>.


Properties

public TemplateEngine Engine

The TemplateEngine Carbide will use.