本文整理匯總了Golang中github.com/MobRulesGames/golua.State.SetMetaTable方法的典型用法代碼示例。如果您正苦於以下問題:Golang State.SetMetaTable方法的具體用法?Golang State.SetMetaTable怎麽用?Golang State.SetMetaTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/MobRulesGames/golua.State
的用法示例。
在下文中一共展示了State.SetMetaTable方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: LuaPushEntity
//.........這裏部分代碼省略.........
ent := _ent.Game().EntityById(id)
L.NewTable()
sides := map[string]Side{
"Denizen": SideHaunt,
"Intruder": SideExplorers,
"Npc": SideNpc,
"Object": SideObject,
}
for str, side := range sides {
L.PushString(str)
L.PushBoolean(ent.Side() == side)
L.SetTable(-3)
}
},
"State": func() {
ent := _ent.Game().EntityById(id)
L.PushString(ent.Sprite().State())
},
"Master": func() {
ent := _ent.Game().EntityById(id)
L.NewTable()
for key, val := range ent.Ai_data {
L.PushString(key)
L.PushString(val)
L.SetTable(-3)
}
},
"GearOptions": func() {
ent := _ent.Game().EntityById(id)
L.NewTable()
if ent.ExplorerEnt != nil {
for _, gear_name := range ent.ExplorerEnt.Gear_names {
var g Gear
g.Defname = gear_name
base.GetObject("gear", &g)
L.PushString(gear_name)
L.PushString(g.Large_icon.Path.String())
L.SetTable(-3)
}
}
},
"Gear": func() {
ent := _ent.Game().EntityById(id)
if ent.ExplorerEnt != nil && ent.ExplorerEnt.Gear != nil {
L.PushString(ent.ExplorerEnt.Gear.Name)
} else {
L.PushNil()
}
},
"Actions": func() {
ent := _ent.Game().EntityById(id)
L.NewTable()
for _, action := range ent.Actions {
L.PushString(action.String())
action.Push(L)
L.SetTable(-3)
}
},
"Pos": func() {
ent := _ent.Game().EntityById(id)
x, y := ent.Pos()
LuaPushPoint(L, x, y)
},
"Corpus": func() {
ent := _ent.Game().EntityById(id)
L.PushInteger(ent.Stats.Corpus())
},
"Ego": func() {
ent := _ent.Game().EntityById(id)
L.PushInteger(ent.Stats.Ego())
},
"HpCur": func() {
ent := _ent.Game().EntityById(id)
L.PushInteger(ent.Stats.HpCur())
},
"HpMax": func() {
ent := _ent.Game().EntityById(id)
L.PushInteger(ent.Stats.HpMax())
},
"ApCur": func() {
ent := _ent.Game().EntityById(id)
L.PushInteger(ent.Stats.ApCur())
},
"ApMax": func() {
ent := _ent.Game().EntityById(id)
L.PushInteger(ent.Stats.ApMax())
},
"Info": func() {
ent := _ent.Game().EntityById(id)
L.NewTable()
L.PushString("LastEntityThatIAttacked")
LuaPushEntity(L, ent.Game().EntityById(ent.Info.LastEntThatIAttacked))
L.SetTable(-3)
L.PushString("LastEntThatAttackedMe")
LuaPushEntity(L, ent.Game().EntityById(ent.Info.LastEntThatAttackedMe))
L.SetTable(-3)
},
})
L.SetMetaTable(-2)
}