added type names for exposed metatables
This commit is contained in:
parent
833e87c830
commit
3f119d585c
@ -68,6 +68,11 @@ int lutil_newmetatablep (lua_State *L, const void *p) {
|
|||||||
|
|
||||||
lua_newtable(L); /* create metatable */
|
lua_newtable(L); /* create metatable */
|
||||||
lua_pushvalue(L, -1); /* duplicate metatable to set*/
|
lua_pushvalue(L, -1); /* duplicate metatable to set*/
|
||||||
|
|
||||||
|
lua_pushliteral (L, "__type");
|
||||||
|
lua_pushstring(L, p); // push meta name
|
||||||
|
lua_settable (L, -3); // set meta name
|
||||||
|
|
||||||
lua_rawsetp(L, LUA_REGISTRYINDEX, p);
|
lua_rawsetp(L, LUA_REGISTRYINDEX, p);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -122,7 +127,6 @@ int lutil_createmetap (lua_State *L, const void *p, const luaL_Reg *methods, int
|
|||||||
lua_pushliteral (L, "__index"); /* define metamethods */
|
lua_pushliteral (L, "__index"); /* define metamethods */
|
||||||
lua_pushvalue (L, -2);
|
lua_pushvalue (L, -2);
|
||||||
lua_settable (L, -3);
|
lua_settable (L, -3);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,8 +219,9 @@ local function form_add(form, data)
|
|||||||
return form
|
return form
|
||||||
end
|
end
|
||||||
|
|
||||||
local function class(ctor)
|
local function class(ctor, type_name)
|
||||||
local C = {}
|
local C = {}
|
||||||
|
C.__type = type_name or "LcURL Unknown"
|
||||||
C.__index = function(self, k)
|
C.__index = function(self, k)
|
||||||
local fn = C[k]
|
local fn = C[k]
|
||||||
|
|
||||||
@ -254,7 +255,7 @@ end
|
|||||||
local function Load_cURLv2(cURL, curl)
|
local function Load_cURLv2(cURL, curl)
|
||||||
|
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
local Easy = class(curl.easy) do
|
local Easy = class(curl.easy, "LcURL Easy") do
|
||||||
|
|
||||||
local perform = wrap_function("perform")
|
local perform = wrap_function("perform")
|
||||||
local setopt_share = wrap_function("setopt_share")
|
local setopt_share = wrap_function("setopt_share")
|
||||||
@ -400,7 +401,7 @@ end
|
|||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
|
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
local Multi = class(curl.multi) do
|
local Multi = class(curl.multi, "LcURL Multi") do
|
||||||
|
|
||||||
local perform = wrap_function("perform")
|
local perform = wrap_function("perform")
|
||||||
local add_handle = wrap_function("add_handle")
|
local add_handle = wrap_function("add_handle")
|
||||||
@ -460,7 +461,7 @@ end
|
|||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
|
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
local Share = class(curl.share) do
|
local Share = class(curl.share, "LcURL Share") do
|
||||||
|
|
||||||
Share.setopt_share = wrap_setopt_flags("share", {
|
Share.setopt_share = wrap_setopt_flags("share", {
|
||||||
[ "COOKIE" ] = curl.LOCK_DATA_COOKIE;
|
[ "COOKIE" ] = curl.LOCK_DATA_COOKIE;
|
||||||
@ -485,7 +486,7 @@ end
|
|||||||
local function Load_cURLv3(cURL, curl)
|
local function Load_cURLv3(cURL, curl)
|
||||||
|
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
local Form = class(curl.form) do
|
local Form = class(curl.form, "LcURL Form") do
|
||||||
|
|
||||||
function Form:__init(opt)
|
function Form:__init(opt)
|
||||||
if opt then return self:add(opt) end
|
if opt then return self:add(opt) end
|
||||||
@ -505,7 +506,7 @@ end
|
|||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
|
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
local Easy = class(curl.easy) do
|
local Easy = class(curl.easy, "LcURL Easy") do
|
||||||
|
|
||||||
function Easy:__init(opt)
|
function Easy:__init(opt)
|
||||||
if opt then return self:setopt(opt) end
|
if opt then return self:setopt(opt) end
|
||||||
@ -595,7 +596,7 @@ end
|
|||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
|
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
local Multi = class(curl.multi) do
|
local Multi = class(curl.multi, "LcURL Multi") do
|
||||||
|
|
||||||
local add_handle = wrap_function("add_handle")
|
local add_handle = wrap_function("add_handle")
|
||||||
local remove_handle = wrap_function("remove_handle")
|
local remove_handle = wrap_function("remove_handle")
|
||||||
@ -717,7 +718,7 @@ end
|
|||||||
end
|
end
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
|
|
||||||
setmetatable(cURL, {__index = curl})
|
setmetatable(cURL, {__index = curl, __type = "LCURL"})
|
||||||
|
|
||||||
function cURL.form(...) return Form:new(...) end
|
function cURL.form(...) return Form:new(...) end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user