Beispiel #1
0
func GSub(L *State, s string, p string, r string) string {
	Cs := C.CString(s)
	Cp := C.CString(p)
	Cr := C.CString(r)
	ret := C.GoString(C.luaL_gsub(L.s, Cs, Cp, Cr))
	C.free(unsafe.Pointer(Cs))
	C.free(unsafe.Pointer(Cp))
	C.free(unsafe.Pointer(Cr))
	return ret
}
Beispiel #2
0
// luaL_gsub
func (L *State) GSub(s string, p string, r string) string {
	Cs := C.CString(s)
	Cp := C.CString(p)
	Cr := C.CString(r)
	defer func() {
		C.free(unsafe.Pointer(Cs))
		C.free(unsafe.Pointer(Cp))
		C.free(unsafe.Pointer(Cr))
	}()

	return C.GoString(C.luaL_gsub(L.s, Cs, Cp, Cr))
}
Beispiel #3
0
func GSub(L *State, s string, p string, r string) string {
	return C.GoString(C.luaL_gsub(L.s, C.CString(s), C.CString(p), C.CString(r)))
}