3
+ name := LUA_CFUNCTION;
5
- author := "Mildred <mildred593(at)online.fr>";
9
// Copyright (c) 2007 Mildred <mildred593(at)online.fr>
11
// Permission is hereby granted, free of charge, to any person
12
// obtaining a copy of this software and associated documentation
13
// files (the "Software"), to deal in the Software without
14
// restriction, including without limitation the rights to use,
15
// copy, modify, merge, publish, distribute, sublicense, and/or sell
16
// copies of the Software, and to permit persons to whom the
17
// Software is furnished to do so, subject to the following
20
// The above copyright notice and this permission notice shall be
21
// included in all copies or substantial portions of the Software.
23
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
25
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30
// OTHER DEALINGS IN THE SOFTWARE.
32
- external := `#define lisaac_call_lua_cfunction static lisaac_call_lua_cfunction0`;
36
- parent_object :OBJECT := OBJECT;
40
- lisaac_call_lua_cfunction lua_p:POINTER :INTEGER <-
43
(lua_p != NULL).if_true {
46
lua := LUA_STATE.create_import lua_p;
47
self := CONVERT[POINTER, SELF].on
48
(lua.touserdata (`lua_upvalueindex(1)`:INTEGER));
56
- call_pointer lua_p:POINTER :INTEGER <-
59
lua := LUA_STATE.create_import lua_p;
63
- call lua:LUA_STATE :INTEGER <- block.value lua;
69
lua.is_valid.if_false {
70
crash_with_message "Lua call of the default C function.";
75
- creator_of_lua_cfunctions :INTEGER := lisaac_call_lua_cfunction NULL;
79
- create block:BLOCK :SELF <-
87
- make block_:BLOCK <-
92
- get_pointer :POINTER <-
94
creator_of_lua_cfunctions;
95
`lisaac_call_lua_cfunction0`:POINTER
100
`(void*) @block`:POINTER
103
// kate: hl Lisaac v0.2; indent-width 2; space-indent on; replace-tabs off;
104
// kate: tab-width 8; remove-trailing-space on;