a lua extend library

Related tags

Build Systems colib
Overview

colib

这是一个Lua扩展库,提供了一些常用的扩展功能,该库还在不断完善中。。。

功能列表

已提供的模块有:

  • rtl模块:
    • 提供基础的面向对象实现。
  • dbg模块:
    • 扩展的traceback函数,可以打印每一调用层级的变量值。
    • 打印Lua对象为字符串形式。
    • 高精度时钟
  • list对象:
    • 数组对象,接口类似于table模块;
    • 提供更快的插入和删除操作
    • 提供更快的排序功能。
    • 禁止将元素值设置为nil。
  • queue对象:
    • 提供比table更快的入队和出队操作。
  • str模块:
    • 一些常用的字符串操作函数,参考了Python的字符串接口。
  • LruCache对象:
    • 基于循环链表的Lru Cache实现。
  • seri模块:
    • 参考自云风的序列化库
    • 代码重写编写,格式上有一点微小的变化。
  • randset对象:
    • 可随机的集合对象
  • weightrand模块:
    • 一个极速的基于权重的随机选择算法
  • MHTimer对象:
    • 一个基于最小堆的定时器实现
  • bitarray对象:
    • 位数组
  • filesys模块
    • 常用的文件和目录接口
  • oset有序集合
    • 基于skiplist实现
  • rand对象
    • 基于xoshiro256**的伪随机数生成器(PRNG)

编译指南

1. 使用xmake编译

安装xmake;然后在根目录下执行:

xmake

如果提示找不到lua.h文件,则需要配置lua的头文件路径,在Windows下:

xmake f --includedirs=<luaincdir> --linkdirs=<lualibdir> --links=<lualib>
# <luaincdir> 替换为Lua代码文件所在的路径,比如:e:\lua\lua-5.4.2\src
# <lualibdir> 替换为编译出来的Lua库文件所在的路径,比如:e:\lua\lua-5.4.2\build\windows\x64\release
# <lualib> 替换为Lua库文件,比如:lua;实际上找的是lua.lib

在其他系统下:

xmake f --includedirs=<luaincdir>
# <luaincdir> 替换为Lua代码文件所在的路径,比如/home/colin/lua-5.4.2/src

上面命令只需要执行一次,以后就不用再执行。接下来仍然执行xmake来编译工程,看看能否成功。

2. 使用make编译

make只支持在非Window系统下编译,同样在根目录下执行(在freebsd下用gmake代替make):

make

如果提示找不到lua.h文件,同样需要指定Lua的头文件路径:

make "INC=-I<luaincdir>"
# <luaincdir> 替换为Lua代码文件所在的路径,比如/home/colin/lua-5.4.2/src

如无意外应该可以编译成功,最后生成colibc.so在colib子目录中。

3. 使用xmake在Windows下编译Lua

根目录下有一个lua-xmake.lua文件,将其拷贝到Lua目录下,比如/home/colin/lua-5.4.2,然后改名为xmake.lua

接着执行:

xmake

如果成功会在build\windows\x64\release生成下面文件:

lua-static.lib		# 静态库
lua.exe				# 执行程序
lua.dll				# 动态库
luac.exe			# 编译程序
lua.lib				# 导入库

使用该库的注意点

  • apis.lua 和其他lua文件都有详尽的接口说明,建议使用 IDEA + EmmyLua 插件,以获得方便的代码提示。
  • test 目录中是各模块的测试代码,查看这些代码可以了解各模块的使用方法。进入test, 然后执行lua test_xxx
  • 由于本人的精力有限,该库只支持 Lua5.3 以上的版本。

系统兼容性

该库只在下面的系统编译通过,其他系统不能保证可以编译

  • Windows 10
  • macOS Big Sur 11.2.3
  • Debian GNU/Linux 10 (buster)
  • Ubuntu 20.04.1 LTS
  • FreeBSD 12
  • CentOS 8

待开发的模块

You might also like...
LAppS - Lua Application Server for micro-services with default communication over WebSockets. The fastest and most vertically scalable WebSockets server implementation ever. Low latency C++ - Lua stack roundtrip.

LAppS - Lua Application Server This is an attempt to provide very easy to use Lua Application Server working over WebSockets protocol (RFC 6455). LApp

The Lua development repository, as seen by the Lua team. Mirrored irregularly

The Lua development repository, as seen by the Lua team. Mirrored irregularly

A dependency free, embeddable debugger for Lua in a single file (.lua or .c)
A dependency free, embeddable debugger for Lua in a single file (.lua or .c)

debugger.lua A simple, embedabble debugger for Lua 5.x, and LuaJIT 2.x. debugger.lua is a simple, single file, pure Lua debugger that is easy to integ

ANSI C library for NURBS, B-Splines, and Bézier curves with interfaces for C++, C#, D, Go, Java, Lua, Octave, PHP, Python, R, and Ruby.

TinySpline TinySpline is a small, yet powerful library for interpolating, transforming, and querying arbitrary NURBS, B-Splines, and Bézier curves. Th

C++ reflection library with Lua binding, and JSON and XML serialisation.

Ponder Linux & OSX: - Windows: Currents status: 3.2-alpha. API is unstable as features added/changed. New: Version 3 V1 replaced Boost with C++11. V2

A lightweight, dependency-free library for binding Lua to C++
A lightweight, dependency-free library for binding Lua to C++

LuaBridge 2.6 LuaBridge is a lightweight and dependency-free library for mapping data, functions, and classes back and forth between C++ and Lua (a po

HARFANG®3D is an all-in-one 3D visualization library usable in C++, Python, Lua and Go.
HARFANG®3D is an all-in-one 3D visualization library usable in C++, Python, Lua and Go.

HARFANG® 3D engine HARFANG®3D is an all-in-one 3D visualization library usable in C++, Python, Lua and Go. Table of contents About Features Screenshot

Just a basic mini library for parsing simple files that only have variables written and with Lua extension.

C++ Parser Lua file config Just a basic mini library for parsing simple files that only have variables written and with Lua extension. Note: At the mo

a one header library for creating Lua bindings to C++

Description A C++ library for generating Lua bindings. Supported features: functions, constructors, inheritance, member functions, properties, standar

Highly efficent, caching, copy-on-write lua vector math library

lua-vec Table constructions in Lua are expensive, creating and destroying thousands of "vector" tables frame to frame in an engine can cause serious p

A simple and easy-to-use Lua library to enjoy videogames programming
A simple and easy-to-use Lua library to enjoy videogames programming

raylib-lua-sol Lua bindings for raylib, a simple and easy-to-use library to enjoy videogames programming, with sol (www.raylib.com) raylib-lua-sol bin

C++11 API for creating Lua bindings

=head1 NAME luacxx - C++11 binding and modules for Lua =head1 SYNOPSIS // Create a new Lua environment to play with. auto env = lua::create

Sol3 (sol2 v3.0) - a C++ - Lua API wrapper with advanced features and top notch performance - is here, and it's great! Documentation:

sol2 sol2 is a C++ library binding to Lua. It currently supports all Lua versions 5.1+ (LuaJIT 2.0+ and MoonJIT included). sol2 aims to be easy to use

Dynamic 3D cellular automata engine with lua scripting support
Dynamic 3D cellular automata engine with lua scripting support

Cell3D Cell3D is a dynamic 3D cellular automata engine with lua scripting support Installation Dependencies: Lua 5.3 Raylib Simplest possible build co

Make Lua great again

LuaLibs Lua 模块合集 • 让 Lua 再次伟大 Lua module collection · Makes Lua great again 已收录项目 项目名称 简介 开发者 Lua API 版本 是否跨平台 LuaHttpLib 阻塞式 HTTP 库 Voidmatrix 5.4.0

JSON lib for Lua

LuaJsonLib JSON 解析库 API 总览 名称 功能 value = Load(str) 将已编码的 JSON 对象解码为 Lua 对象 value = LoadFromFile(path) 将指定路径文件中已编码的 JSON 对象解码为 Lua 对象 str = Dump(value

custom lua godot engine module

Godot Lua Module Table of contents: About Features TODO Compiling Examples Contributing And Feature Requests About This is a Godot engine module that

A programming environment for Lua for the Raspberry Pi Pico microcontroller

picolua A programming environment for Lua for the Raspberry Pi Pico microcontroller. Version 0.3, April 2021 What is this? picolua is a proof-of-conce

Lua for Plan 9 space

lu9 -- Lua for Plan 9 space lu9 is an umbrella project providing a native Plan 9 port of the Lua library and several other libraries and programs buil

Comments
  • 关于内存分配函数

    关于内存分配函数

    作者您好,在 src/coconf.h 中使用的内存分配函数是 malloc/free/realloc/calloc,而不是Lua 提供的 src/lmem.h 中的 luaM_realloc_,我觉得这个设计可能会导致 Lua 不能够正确的统计到程序使用总内存量,如果使用者修改了 luaM_realloc,使用了自定义的内存池来监控内存,也应该会导致内存统计出现偏差。不知道您这个设计是有什么其他目的吗?

    opened by LiuYinCarl 6
Owner
colin
Life is not what you have gained, but what you have done
colin
custom lua godot engine module

Godot Lua Module Table of contents: About Features TODO Compiling Examples Contributing And Feature Requests About This is a Godot engine module that

Trey Moller 65 Jan 7, 2023
Lua for Plan 9 space

lu9 -- Lua for Plan 9 space lu9 is an umbrella project providing a native Plan 9 port of the Lua library and several other libraries and programs buil

kvik 20 Dec 24, 2022
Disassembler for compiled Lua scripts

Luad English | Русский Luad - Disassembler for compiled Lua scripts. At the moment the program is in development (v0.12-pre-alpha). Supported compiler

Vitaliy Vorobets 12 Oct 20, 2022
C++ Library Manager for Windows, Linux, and MacOS

Vcpkg: Overview 中文总览 Español 한국어 Français Vcpkg helps you manage C and C++ libraries on Windows, Linux and MacOS. This tool and ecosystem are constant

Microsoft 17.5k Jan 1, 2023
nabs is a single-header library for writing build recipes in C++

nabs is a single-header library for writing build recipes in C++. It is directly inspired by nobuild, but with more feature (bloat) and built-in support for makefile-like dependency resolution.

zhiayang 6 May 8, 2021
Simple library for embedding static resources into C++ binaries using CMake

libromfs libromfs is an easy way to bundle resources directly into any C++ application and access them through a simple interface. The main advantage

WerWolv 28 Nov 30, 2022
Example library that shows best practices and proper usage of CMake by using targets

Modern CMake Sample Sample project that shows proper modern CMake usage on a dummy library and an executable that uses it. Accompanying code to my blo

Pablo Arias 601 Dec 29, 2022
An OS-agnostic C++ library template in plain CMake.

?? How to export C++ library This repository provides an OS-agnostic C++ library template with plain CMake files with the following features: distribu

Robotology 302 Dec 17, 2022
Utility and common library for all polysquare cmake tools.

Polysquare CMake Tooling Utility Functions Utility and common library for all polysquare cmake tools. Status Travis CI (Ubuntu) AppVeyor (Windows) Cov

ポリ平方 POLYSQUARE 3 May 7, 2021
lua-nuspell is a set of Lua 5.x bindings for Nuspell spellchecking C++ library.

lua-nuspell lua-nuspell is a set of Lua 5.x bindings for Nuspell spellchecking C++ library. About Nuspell Nuspell is a fast and safe spelling checker

AF 8 Nov 8, 2022