LuaJIT-to-Go/types.go

52 lines
995 B
Go

package luajit
/*
#include <lua.h>
*/
import "C"
// LuaType represents Lua value types
type LuaType int
const (
// These constants must match lua.h's LUA_T* values
TypeNone LuaType = -1
TypeNil LuaType = 0
TypeBoolean LuaType = 1
TypeLightUserData LuaType = 2
TypeNumber LuaType = 3
TypeString LuaType = 4
TypeTable LuaType = 5
TypeFunction LuaType = 6
TypeUserData LuaType = 7
TypeThread LuaType = 8
)
// String returns the string representation of the Lua type
func (t LuaType) String() string {
switch t {
case TypeNone:
return "none"
case TypeNil:
return "nil"
case TypeBoolean:
return "boolean"
case TypeLightUserData:
return "lightuserdata"
case TypeNumber:
return "number"
case TypeString:
return "string"
case TypeTable:
return "table"
case TypeFunction:
return "function"
case TypeUserData:
return "userdata"
case TypeThread:
return "thread"
default:
return "unknown"
}
}