Пример #1
0
func (value *basicValue) check(f unsafe.Pointer) bool {
	// put the reference on stack
	C.js_getregistry(value.state.vm, value.ref)
	defer C.js_pop(value.state.vm, 1)

	// use the 'check' wrapper to call the validation function
	return C.check(f, value.state.vm) == 1
}
Пример #2
0
// Bool ...
func (value *basicValue) Bool() bool {
	C.js_getregistry(value.state.vm, value.ref)
	defer C.js_pop(value.state.vm, 1)
	return C.js_toboolean(value.state.vm, 0) == 1
}
Пример #3
0
// String ...
func (value *basicValue) String() string {
	C.js_getregistry(value.state.vm, value.ref)
	defer C.js_pop(value.state.vm, 1)
	return C.GoString(C.js_tostring(value.state.vm, 0))
}
Пример #4
0
// Integer ...
func (value *basicValue) Integer() int {
	C.js_getregistry(value.state.vm, value.ref)
	defer C.js_pop(value.state.vm, 1)
	return int(C.js_toint32(value.state.vm, 0))
}
Пример #5
0
// Float ...
func (value *basicValue) Float() float64 {
	C.js_getregistry(value.state.vm, value.ref)
	defer C.js_pop(value.state.vm, 1)
	return float64(C.js_tonumber(value.state.vm, 0))
}