hedgewars/uScript.pas
branchphysfslayer
changeset 8025 07862ab415c8
parent 8012 2a61631a4505
child 8031 fc40b343c45c
equal deleted inserted replaced
8022:10b3b93c1f56 8025:07862ab415c8
  1590         begin
  1590         begin
  1591         LuaError('Lua: Wrong number of parameters passed to GetDataPath!');
  1591         LuaError('Lua: Wrong number of parameters passed to GetDataPath!');
  1592         lua_pushnil(L);
  1592         lua_pushnil(L);
  1593         end
  1593         end
  1594     else
  1594     else
  1595         lua_pushstring(L, str2pchar(Pathz[ptData]));
  1595         lua_pushstring(L, str2pchar(cPathz[ptData]));
  1596     lc_getdatapath:= 1
  1596     lc_getdatapath:= 1
  1597 end;
  1597 end;
  1598 
  1598 
  1599 function lc_getuserdatapath(L : Plua_State) : LongInt; Cdecl;
  1599 function lc_getuserdatapath(L : Plua_State) : LongInt; Cdecl;
  1600 begin
  1600 begin
  1602         begin
  1602         begin
  1603         LuaError('Lua: Wrong number of parameters passed to GetUserDataPath!');
  1603         LuaError('Lua: Wrong number of parameters passed to GetUserDataPath!');
  1604         lua_pushnil(L);
  1604         lua_pushnil(L);
  1605         end
  1605         end
  1606     else
  1606     else
  1607         lua_pushstring(L, str2pchar(UserPathz[ptData]));
  1607         lua_pushstring(L, str2pchar(cPathz[ptData]));
  1608     lc_getuserdatapath:= 1
  1608     lc_getuserdatapath:= 1
  1609 end;
  1609 end;
  1610 
  1610 
  1611 function lc_maphasborder(L : Plua_State) : LongInt; Cdecl;
  1611 function lc_maphasborder(L : Plua_State) : LongInt; Cdecl;
  1612 begin
  1612 begin
  1967 
  1967 
  1968 procedure ScriptLoad(name : shortstring);
  1968 procedure ScriptLoad(name : shortstring);
  1969 var ret : LongInt;
  1969 var ret : LongInt;
  1970       s : shortstring;
  1970       s : shortstring;
  1971 begin
  1971 begin
  1972 s:= UserPathz[ptData] + '/' + name;
  1972 s:= cPathz[ptData] + '/' + name;
  1973 if not FileExists(s) then
       
  1974     s:= Pathz[ptData] + '/' + name;
       
  1975 if not FileExists(s) then
  1973 if not FileExists(s) then
  1976     exit;
  1974     exit;
  1977 
  1975 
  1978 ret:= luaL_loadfile(luaState, Str2PChar(s));
  1976 ret:= luaL_loadfile(luaState, Str2PChar(s));
  1979 if ret <> 0 then
  1977 if ret <> 0 then