Stable framework for networked applications in lua and C
Switch branches/tags
Nothing to show
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.
app
c
lib
module
www
README.md
cv.lua
vm_kernel.lua

README.md

What is ^v

^v, pronounced karit-vee is the (esoteric) name of my series of IRC bots, It became the base for almost all of my lua projects.

^v4 was my largest and most messy collection of code ever, little documentation and hard to read, though what was made possible by it is quite impressive.

While previous generations of ^v were build around IRC, this one is built as a framework for any Lua or C application.

Lua by itself lacks functionality so developing large networked applications is hard compared to frameworks like node.js and Django.

Why?

Why does an IRC bot need to have a million and a half APIs, a webserver, a minecraft rcon client, image manipulation, audio generation, syntax highligter, a websocket web terminal, and more?

Why not?

  1. Easy debugging of everything from a single REPL.

  2. No more boilerplate, its all there!

  3. Show off to your friends on IRC.

  4. Friends/Coworkers can interact and help debug/break code in IRC with you.

LuaJIT

Here is why Lua(JIT) is a superior platform than JS and others for real-time networked applications (including games):

  1. LuaJIT is crazy fast for a dynamically typed laguage, due to profiling unoptimized LuaJIT code can beat even C and C++ in some cases by using the most efficient container.

  2. FFI (Lua -> C) is extremely fast in LuaJIT compared to FFI implementations in JS so integration with existing C code has less overhead.

  3. Lua natively has coroutines so you dont have to go through callback hell to do procedural tasks like in node.js.

  4. Implementations are smaller and can run on an RTOS easily.

  5. Syntax and objects are extremely simple, learning curve is tiny.

  6. Already used by large companies in realtime applications (Rackspace, Valve, Volition).

And here is why Lua sucks:

  1. Indexes start at 1

  2. You only get errors at runtime like most dynamically typed languages.

  3. No classes (and class implementations are usually slow) so you are more prone to non-fatal typos

  4. Strings are ASCII (sorry Java programmers)

  5. Relatively small community so there arent as many libraries to do all the cool things you want to do.

  6. The primary source of Lua libraries, Luarocks, still does not have pre-built binaries so its harder to develop on windows

C and C++

A main problem with developing applications like games in Lua is that sometimes even LuaJIT isnt fast and low-level enough.

For example, me and friends were planning to create a open-world space physics game in the game engine Love2D.

While Love2D had everything we needed to create the game but we cant make the necessary optimizations for physics and graphics that you can do with OpenGl and C++.

With this project proper and easy C/C++ integration while maintaining the flexibility you get from Lua is a must.

The most basic function of ^v, cv.require() automatically loads C/C++ files as if they were Lua files.

Using special comment commands it will automatically compile C/C++ files without needing to make headers or even makefiles for rapid development.

Goals

^v6 main goals:

  1. Well documented: Inlined documentation for apis, generating a webpage simmilar to doxgen.

  2. Powerful: Advanced thread and state managment, asyncronous IO without callbacks, flexible module system.

  3. Modularity: Ability to load and reload modules without even restarting.

  4. Scalability: Your code is fully non-blocking with fast and reliable thread intercommunication.

  5. Easy to use and install: simple APIs with good example code, all C code is automatically compiled by ^v6 at runtime

Core libraries

  1. task: Fully asyncronous tasks, no callbacks necessary.

  2. event: Push events and register callbacks for those events across threads like IRC bot commands.

  3. asyncFS: Filesystem operations without blocking the thread.

  4. asyncSocket: Connecting, Binding, HTTP, Etc are completely asyncronous.

  5. proxy: A C++ proxy for Lua objects, access objects across states seamlessly.

  6. exception: Exception implementation, extremely useful for obvious reasons.

  7. state: Powerful Lua state and thread managment

Planned modules

  1. IRC (obviously): complete IRC support, whox, dcc, etc.

  2. Webserver: Better webserver, comparable perormance and scalability to NGINX and Apache.

  3. ToastNet: Secure, decentralized peer-to-peer network as a fun project.

  4. IRC server: Advanced IRC server highly configurable.

Sponsorship

If you would like to sponsor this project, please email me at andre.lipke@gmail.com