Ambrevar / golua

[MOVED TO GITLAB] Package unicode adds unicode support to some functions in golua's string library.

Home Page:https://gitlab.com/ambrevar/golua

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Golua Unicode Support

This extension to Arzilli's Golua adds Unicode support to all functions from the Lua string library.

Lua patterns are replaced by Go regexps. This breaks compatibility with Lua, but Unicode support breaks it anyways and Go regexps are more powerful.

Example

package main

import (
	"github.com/ambrevar/golua/unicode"
	"github.com/aarzilli/golua/lua"
)

func main() {
	L := lua.NewState()
	defer L.Close()
	L.OpenLibs()
	unicode.GoLuaReplaceFuncs(L)

	L.DoString(`print(string.len("résumé"))`)
	L.DoString(`print(string.upper("résumé"))`)
	L.DoString(`print(string.gsub("résumé", "\\pL", "[$0]"))`)
}

About

[MOVED TO GITLAB] Package unicode adds unicode support to some functions in golua's string library.

https://gitlab.com/ambrevar/golua


Languages

Language:Go 100.0%