Comments (4)
Okay after looking at it again, when the type is an adress (int * / char * / any *), lua / js part sees it as a return value when it's not always the case
from natives.
Lua doesn't return by reference parameters, but C# can do that by using out
parameters. It seems to me, that you may be confused about how Lua returns values. Lua can only return values via the return statement i.e.
In Lua
function getCoordinates()
local x = 10
local y = 20
return x, y
end
local result1, result2 = getCoordinates()
print(result1, result2) -- Outputs: 10 20
In C#
public void GetCoordinates(out int x, out int y)
{
x = 10;
y = 20;
}
int result1, result2;
GetCoordinates(out result1, out result2);
Console.WriteLine($"{result1}, {result2}"); // Outputs: 10, 20
Perhaps the current RemoveBlip
example for Lua is a bit confusing, but it's basically:
local coords = vector3(200.0, 200.0, 5.0)
local blip = AddBlipForCoord(coords)
-- When you want to remove it
local removedBlipHandle = RemoveBlip(blip)
Citizen.Trace('Removed blip: ' .. removedBlipHandle)
I haven't tested the code above, it's only for illustration purposes.
Hope that cleared your doubts 🙂
from natives.
Hey, thanks for the clear explanations. I do know that lua functions need the return statement to return values and that there is no pointers that can be used like in C#. My concern was mainly for your example, the RemoveBlip needs the blip to remove to be a parameter, but if you look in the natives website :
-- REMOVE_BLIP
local blip --[[ Blip ]] = RemoveBlip()
It's not explicit that you need to use RemoveBlip(ThisBlip).
from natives.
Hey,
Thanks for the report @Mathu-lmn. I push a PR in #1095 to "fix" the issue. We just need to wait now!
Big love :)
from natives.
Related Issues (20)
- Nigh HOT 1
- R
- Some natives "improve" link, links to wrong github
- Duplicated native HOT 4
- SET_PED_CONFIG_FLAG RPC native takes a long time to load
- Long natives name HOT 3
- Link in `SetRadiusBlipEdge`'s description doesn't work anymore HOT 7
- CreateMissionTrain changed in 2802 HOT 1
- PAS Updates HOT 3
- --- ns: VEHICLE aliases: ["0x9D44FCCE98450843"] --- ## _SET_VEHICLE_SILENT ```c // 0x9D44FCCE98450843 0x968E5770 void _SET_VEHICLE_SILENT(Vehicle vehicle, BOOL toggle); ``` ``` If set to TRUE, it seems to suppress door noises and doesn't allow the horn to be continuous. ``` ## Parameters * **vehicle**: * **toggle**: HOT 1
- How can I get intrinsic matrices and transformation matrices from depth to world corrdinate? HOT 1
- Migrate FiveM Natives into native pepository HOT 4
- ForcelightningFlash() at coords?
- Centralize Enums and Bones Documentation
- Native type declarations HOT 1
- Issue with ApplyPedBloodSpecific HOT 4
- Issue with GetVehicleModelNumberOfSeats HOT 2
- Update N_0x83a169eabcdb10a2 HOT 3
- Questions regarding two audio natives
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from natives.