Skip to content

Instantly share code, notes, and snippets.

View MindScriptAct's full-sized avatar

Raimundas Banevicius MindScriptAct

View GitHub Profile
@MindScriptAct
MindScriptAct / TTS LUA : static class template
Last active February 19, 2020 16:33
TableTop simulator lua static class template
local MyStaticClass = {}
local data;
function MyStaticClass:SetData(newData)
data = newData
end
function MyStaticClass:PrintData()
print(data)
@MindScriptAct
MindScriptAct / TTS LUA : readonly constant template
Last active February 23, 2020 10:37
TableTop simulator lua readonly table template
require("msa/Core")
local Constants = readonly {
MyNumber = 12.34,
MyString = "Some String",
MyObject = readonly {Data = "My Object data", Count = 123},
MyPosition = readonly {x = 1, y = 2, z = 3},
MyColor = readonly {r = 0.5, g = 0.5, b = 0.5, m = 1}
}
@MindScriptAct
MindScriptAct / TTS LUA : singleton class template
Last active February 19, 2020 16:32
TableTop simulator lua singleton class template
local MySingleton = {}
MySingleton.__index = MySingleton
setmetatable(MySingleton, {__call = function (cls, ...) return cls.GetInstance(...) end })
local instance
function MySingleton.GetInstance()
if instance == nil then
instance = setmetatable({}, MySingleton)
end
return instance
local MyClass = {}
MyClass.__index = MyClass
setmetatable(MyClass, {__call = function (cls, ...) return cls.New(...) end })
function MyClass.New(initData)
local self = setmetatable({}, MyClass)
self.data = initData
return self
@MindScriptAct
MindScriptAct / TTS LUA : class template
Last active May 1, 2023 16:55
TableTop simulator lua class template
local MyClass = {}
MyClass.__index = MyClass
setmetatable(MyClass, {__call = function (cls, ...) return cls.New(...) end })
function MyClass.New(initData)
local self = setmetatable({}, MyClass)
self.data = initData
return self
### Animator initialization:
```lua
-- Init
local animator = Animator()
local animation = animator:InitAnimation()
-- plan your animation
animation:Move(ObjectId.TestTile1, ObjectId.InBag1, 0, HandleMoveToItemDone)
public bool OpenConnection(string dbFalieName)
{
if (!File.Exists(dbFalieName))
{
SQLiteConnection.CreateFile(dbFalieName);
connection = new SQLiteConnection("Data Source=" + dbFalieName + ";Version=3;");
InitTables();
}
else
{
@MindScriptAct
MindScriptAct / Enum.as
Last active December 7, 2016 08:07
As3 Enum class.
package utils.data {
import flash.utils.Dictionary;
import flash.utils.getQualifiedClassName;
/**
* Base class for creation of enumerable type-safe constants. (Similar to Enum in c++)
*
* @Example:
*
* package {
package {
import flash.utils.Dictionary;
/**
* Contains country codes and names.
*/
public class Country {
public static var allCountries:Dictionary = new Dictionary();
{
/**
* Created by Raimundas Banevicius on 8/15/2016.
*/
package utils.text {
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
public class TextHelper {