Lua is a simple, small, fast, easy to learn embeddable language. It can be very useful in projects such as Algine, since there are a lot of things that we can do much easier with language like Lua.
Firstly, we need Lua to get rid of awful, overcomplicated, inflexible, hard to maintain json configs that we are now using in Creators.
Secondly, we need Lua to simplify developer’s lives - not all projects need to be written in C++, so in this case easy to learn language like Lua would be a great solution.
And finally, we need Lua to create Editor, since it will be much easier to create it using language like Lua.
Lua support is provided by the solgen library.
An approximate list of classes that need lua support to be implemented:
Creators:
Core:
Widgets:
Std:
Glm:
Tulz:
In reality this list will be much bigger
require
to load Algine types (base, widgets, core (base+widgets), std, glm, tulz), e.g. require('algine:core')
tostring
for tablesprint
to add ability to print tablesstatic_cast<return_type (T::*)(args)>(&T::function_name)
static_cast<return_type (*)(args)>(&T::function_name)
usertype["function"] = [](const sol::object &self, ...) { self.as<T>().function(...); };
Lua::new_enum
allows you to create an enum and then make it as a class memberLua::new_property
creates property and additionally makes getter and setterScriptable
, then you also need to define static void registerLuaUsertype(Lua *lua)