예제 #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
}
예제 #2
0
파일: lauxlib.go 프로젝트: 1lann/golua
// 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))
}
예제 #3
0
파일: lauxlib.go 프로젝트: afitz/golua
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)))
}