1 (in-package #:cl-lua-ffi)
3 (define-foreign-library liblua50
4 (T (:default "liblua50")))
6 (use-foreign-library liblua50)
8 (defctype lua-state :pointer)
10 (defctype lua-number :double)
12 (defctype size :unsigned-int)
26 (defcfun lua-open lua-state)
28 (defcfun lua-close :void
31 (defcfun lua-newthread :void
36 (defcfun lua-gettop :int
39 (defcfun lua-settop :void
43 (defcfun lua-pushvalue :void
47 (defcfun lua-remove :void
51 (defcfun lua-insert :void
55 (defcfun lua-replace :void
59 (defcfun lua-checkstack :boolean
63 (defcfun lua-xmove :void
68 (defcfun lua-isnumber :boolean
72 (defcfun lua-isstring :boolean
76 (defcfun lua-iscfunction :boolean
80 (defcfun lua-isuserdata :boolean
84 (defcfun lua-type lua-type
88 ;; TODO: type is an enum
89 (defcfun lua-typename :string
93 (defcfun lua-equal :boolean
98 (defcfun lua-rawequal :boolean
103 (defcfun lua-lessthan :boolean
108 (defcfun lua-tonumber lua-number
112 (defcfun lua-toboolean :boolean
116 (defcfun lua-tostring :string
120 (defcfun lua-strlen size
124 ;; TODO: lua-tocfunction
126 (defcfun lua-touserdata :pointer
130 (defcfun lua-tothread lua-state
134 (defcfun lua-topointer :pointer
138 (defcfun lua-pushnil :void
141 (defcfun lua-pushnumber :void
145 (defcfun lua-pushlstring :void
150 ;; TODO: lua-pushstring
151 ;; TODO: lua-pushvfstring
152 ;; TODO: lua-pushfstring
153 ;; TODO: lua-pushcclosure
155 (defcfun lua-pushboolean :void
159 (defcfun lua-pushlightuserdata :void
163 (defcfun lua-gettable :void
167 (defcfun lua-rawget :void
171 (defcfun lua-rawgeti :void
176 (defcfun lua-newtable :void
179 (defcfun lua-newuserdata :pointer
183 (defcfun lua-getmetatable :int
187 (defcfun lua-getfenv :void
191 (defcfun lua-settable :void
195 (defcfun lua-rawset :void
199 (defcfun lua-rawseti :void
204 (defcfun lua-setmetatable :boolean
208 (defcfun lua-setfenv :boolean
212 (defcfun lua-call :void
217 (defcfun lua-pcall :void
227 (defcfun lua-yield :boolean
231 (defcfun lua-resume :void
235 (defcfun lua-getgcthreshold :int
238 (defcfun lua-gccount :int
241 (defcfun lua-setgcthreshold :void
245 (defcfun lua-version :string)
249 (defcfun lua-next :boolean
253 (defcfun lua-concat :void
257 ;; TODO: lua-boxpointer
258 ;; TODO: lua-unboxpointer
260 (defun lua-pop (state n)
261 (lua-settop state (1- (- n))))
263 ;; TODO: lua-register
264 ;; TODO: lua-pushcfunction
266 (defun lua-isfunction (state n)
267 (eq (lua-type state n) :function))
269 (defun lua-istable (state n)
270 (eq (lua-type state n) :table))
272 (defun lua-islightuserdata (state n)
273 (eq (lua-type state n) :lightuserdata))
275 (defun lua-isnil (state n)
276 (eq (lua-type state n) :nil))
278 (defun lua-isboolean (state n)
279 (eq (lua-type state n) :boolean))
281 (defun lua-isnone (state n)
282 (eq (lua-type state n) :none))
284 (defun lua-isnoneornil (state n)
285 (let ((type (lua-type state n)))
286 (or (eq type :function)
289 ;; TODO: lua-pushliteral