Code: Select all
PrototypeC.i __proto_luaL_loadfilex (lua_State.i, filename.p-ascii, mode.p-ascii)
Global luaL_loadfilex.__proto_luaL_loadfilex
Code: Select all
luaL_loadfilex(lua_State, "Hallo", #null)
Code: Select all
PrototypeC.i __proto_luaL_loadfilex (lua_State.i, filename.p-ascii, mode.p-ascii)
Global luaL_loadfilex.__proto_luaL_loadfilex
Code: Select all
luaL_loadfilex(lua_State, "Hallo", #null)
this is correct. The c-routine want here a "const char *mode" - #null would send a 0, #null$ would send a adress to a null-terminated empty string. The document says, that you should send a Null and not a null-terminated empty string.Mistrel wrote:#Null is 0 while #Null$ is null-terminated empty string.
You can't pass an integer as an argument to any form of PureBasic string. Altering this behavior would be a fundamental change; and in this light doesn't seem feasible.GPI wrote:The c-routine want here a "const char *mode" - #null would send a 0, #null$ would send a adress to a null-terminated empty string. The document says, that you should send a Null and not a null-terminated empty string.
Code: Select all
PrototypeC.i _null_proto_luaL_loadfilex (lua_State.i, filename.p-ascii, mode.i)
Global _null_luaL_loadfilex._null_proto_luaL_loadfilex
PrototypeC.i _string_proto_luaL_loadfilex (lua_State.i, filename.p-ascii, mode.p-ascii)
Global _string_luaL_loadfilex._string_proto_luaL_loadfilex
Procedure.i luaL_loadfilex(lua_State.i, filename.s, mode.s)
If mode.s=""
ProcedureReturn _null_luaL_loadfilex(lua_State, filename.s, #Null)
EndIf
ProcedureReturn _string_luaL_loadfilex(lua_State, filename.s, mode.s)
EndProcedure
yes, but pseudotypes are meant to be used for lib/api calls.Mistrel wrote:You can't pass an integer as an argument to any form of PureBasic string.
No! You mix here two different things:Mistrel wrote:... while #Null$ is null-terminated empty string
Code: Select all
Procedure Test (a$, b$)
Debug @a$
Debug @b$
EndProcedure
Test (#Null$, #Empty$)
#Empty$: represents an empty string (exactly the same as "")
#Null$ : represents an null string. This can be used for API
functions requiring a null pointer to a string, or to really free a string.