Skip to content
LuaScriptPlugin for Duality2D Game Engine
C# Lua
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Data
Source
.gitignore
AppData.dat
DDoc.chm
DefaultUserData.dat
DesignTimeData.dat
Duality.dll
DualityEditor.exe
DualityEditor.exe.config
NuGet.Core.dll
Package.nuspec
PackageConfig.xml
README.md
VistaBridgeLibrary.dll
Windows7.DesktopIntegration.dll

README.md

Lua Script Plugin for Duality

This is a Lua script plugin for the Game Framework Duality

Installation

  1. Open Duality
  2. File -> Manage Packages
  3. View "Online Repository"
  4. Select "Lua Script Core Plugin" and click "install".
  5. Select "Lua Script Editor Plugin" and click "install".
  6. Click "Apply"
  7. Done!

Usage

  1. Create a GameObject
  2. Add a LuaScriptExecutor Component
  3. Create a LuaScript Resource in the resource view (or just drop a .lua file in there)
  4. Drag the LuaScript resource to the "Script" property on the "LuaScriptExecutor" component.
  5. Run!

You can also just create an empty LuaScript resource and open it in a texteditor. This will generate a default script that is pretty self explanatory (with comments).

Good luck, have fun!

Here's a sample script:

Start & update functions are called automatically for the script

-- Lua Script
-- Import namespaces to use CLR objects
import ('OpenTK')

-- The attached GameObject for this component is already available as a local named gameObject

-- Called in OnInitialize of the component
function start()
end

-- Called in OnUpdate of the component, override LuaScriptExecutor to change passed delta
function update(delta)
	-- example: Move the gameObject to the right by delta time
	gameObject.Transform:MoveBy(Vector2(1, 0) * delta);
end

-- Function ready to be called by overriding LuaScriptExecutorComponent and using "Engine.CallMethod("my_custom_function", 123);"
-- Remove if you don't want it
function my_custom_function(number)
	-- TODO: do something
end
You can’t perform that action at this time.