本文整理汇总了Golang中github.com/aarzilli/golua/lua.State.RawEqual方法的典型用法代码示例。如果您正苦于以下问题:Golang State.RawEqual方法的具体用法?Golang State.RawEqual怎么用?Golang State.RawEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/aarzilli/golua/lua.State
的用法示例。
在下文中一共展示了State.RawEqual方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: MessThingIndex
func MessThingIndex(state *lua.State) int {
log.Println("HEY WE MADE IT")
printStackTypes(state)
state.GetMetaTable(1)
state.LGetMetaTable(ThingMetaTableName)
isThing := state.RawEqual(-1, -2)
state.Pop(2)
if !isThing {
log.Println("!!! OMG ARG #1 IS NOT A MESS.THING !!!")
}
fieldName := state.CheckString(2)
log.Println("Arg #2 checks out, it's a string")
thing := checkThing(state, 1)
log.Println("So we're tryin'a look up", fieldName, "on thing", thing.Id)
if member, ok := MessThingMembers[fieldName]; ok {
return member(state, thing)
}
// That wasn't one of our members, so look it up in our Table.
if data, ok := thing.Table[fieldName]; ok {
// TODO: instead of pushing a whole map if the script asks for one, maybe we should use another kind of userdata that tracks the name & can access its submembers until the script asks for the leaf (or a non-existent branch)?
pushValue(state, data)
return 1
}
// uh... I guess we didn't do anything, so...?
return 0
}