[MOVED TO GITLAB] Package unicode adds unicode support to some functions in golua's string library.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
unicode
README.md

README.md

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]"))`)
}