Skip to content

lua lib, performs char (an ASCII char from 0 to 255) to value replacements inside the given string

License

Notifications You must be signed in to change notification settings

Darvame/odielak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ODIELAK

A small lua lib, that performs char (1 byte char from 0 to 255) to value replacements, like string.gsub, but more faster and has some additional features (like functions and a metatable __tostring attr)

	-- with lak
	local lak = require "odielak";

	local escape = lak.new({
		['&'] = '&',
		['<'] = '&lt;',
		['>'] = '&gt;'
	});

	local escaped_str = escape("escape >th&is<");
	-- escaped_str = "escape &gt;th&amp;is&lt;"
	-- same with gsub

	local t = {
		['&'] = '&amp;',
		['<'] = '&lt;',
		['>'] = '&gt;'
	}

	local r = "[&<>]";

	local escaped_str = string.gsub("escape >th&is<", r, t);
	-- escaped_str = "escape &gt;th&amp;is&lt;"

checkout example.lua for examples and more info


BUILDING & INSTALLATION

Downloading:

git clone https://github.com/Darvame/odielak.git
cd odielak

Setting Variables:

#by default sudo does not pass exported variables
#you may need to run everything bellow (from this point) with root
#in order to use '$ make install'
su -
#or call make with specified variables
make CC=clang
  • with pgk-config
export LUAPKG=lua5.2 #or any ('luajit', 'lua5.1', 'lua5.3')
  • without pgk-config
# this values are defaults (from luajit), do not set if have the same
export PREFIX=/usr/local #prefix
export LUA_LIBDIR=$PREFIX/lib/lua/5.1 #path to lua libs, used only for '$ make install'
export LUA_INCDIR=-I$PREFIX/include/luajit-2.0 #path to lua headers
export LUA=$PREFIX/bin/luajit #lua executable, used only for '$ make test'
  • with clang
export CC=clang #if build on osx

Building & Installing:

make install

About

lua lib, performs char (an ASCII char from 0 to 255) to value replacements inside the given string

Resources

License

Stars

Watchers

Forks

Packages

No packages published