2
2
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:
sammyette 2025-06-14 10:39:58 -04:00
parent 9c0819969f
commit 0e1e964948
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
2 changed files with 10 additions and 0 deletions

View File

@ -49,6 +49,8 @@ func (mlr *Runtime) pushToState(v Value) {
mlr.state.PushNil()
case StringType:
mlr.state.PushString(v.AsString())
case BoolType:
mlr.state.PushBoolean(v.AsBool())
case TableType:
tbl := v.AsTable()
tbl.SetRuntime(mlr)

View File

@ -102,6 +102,14 @@ func (v Value) AsString() 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 {
return v.iface.(*Table)
}