mirror of
https://github.com/Hilbis/Hilbish
synced 2025-07-01 08:42:04 +00:00
feat: impl bool for clua
This commit is contained in:
parent
9c0819969f
commit
0e1e964948
@ -49,6 +49,8 @@ func (mlr *Runtime) pushToState(v Value) {
|
|||||||
mlr.state.PushNil()
|
mlr.state.PushNil()
|
||||||
case StringType:
|
case StringType:
|
||||||
mlr.state.PushString(v.AsString())
|
mlr.state.PushString(v.AsString())
|
||||||
|
case BoolType:
|
||||||
|
mlr.state.PushBoolean(v.AsBool())
|
||||||
case TableType:
|
case TableType:
|
||||||
tbl := v.AsTable()
|
tbl := v.AsTable()
|
||||||
tbl.SetRuntime(mlr)
|
tbl.SetRuntime(mlr)
|
||||||
|
@ -102,6 +102,14 @@ func (v Value) AsString() string {
|
|||||||
return v.iface.(string)
|
return v.iface.(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (v Value) AsBool() bool {
|
||||||
|
if v.Type() != BoolType {
|
||||||
|
panic("value type was not bool")
|
||||||
|
}
|
||||||
|
|
||||||
|
return v.iface.(bool)
|
||||||
|
}
|
||||||
|
|
||||||
func (v Value) AsTable() *Table {
|
func (v Value) AsTable() *Table {
|
||||||
return v.iface.(*Table)
|
return v.iface.(*Table)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user